GRASS GIS 8 Programmer's Manual  8.4.0dev(2024)-f8115df121
mm_utils.cpp
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * MODULE: iostream
4  *
5 
6  * COPYRIGHT (C) 2007 Laura Toma
7  *
8  *
9 
10  * Iostream is a library that implements streams, external memory
11  * sorting on streams, and an external memory priority queue on
12  * streams. These are the fundamental components used in external
13  * memory algorithms.
14 
15  * Credits: The library was developed by Laura Toma. The kernel of
16  * class STREAM is based on the similar class existent in the GPL TPIE
17  * project developed at Duke University. The sorting and priority
18  * queue have been developed by Laura Toma based on communications
19  * with Rajiv Wickremesinghe. The library was developed as part of
20  * porting Terraflow to GRASS in 2001. PEARL upgrades in 2003 by
21  * Rajiv Wickremesinghe as part of the Terracost project.
22 
23  *
24  * This program is free software; you can redistribute it and/or modify
25  * it under the terms of the GNU General Public License as published by
26  * the Free Software Foundation; either version 2 of the License, or
27  * (at your option) any later version.
28  *
29 
30  * This program is distributed in the hope that it will be useful,
31  * but WITHOUT ANY WARRANTY; without even the implied warranty of
32  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
33  * General Public License for more details. *
34  * **************************************************************************/
35 
36 #include <sys/types.h>
37 #include <ctype.h>
38 #include <ostream>
39 #include <iostream>
40 #include <stdio.h>
41 
42 // #include <mm.h>
43 #include <grass/iostream/mm.h>
44 
46 {
47  size_t sz_avail = 0;
48  sz_avail = MM_manager.memory_available();
49  printf("available memory: %.2fMB\n", sz_avail / (float)(1 << 20));
50 }
51 
53 {
54  size_t fmem;
56  return fmem;
57 }
58 
59 void MEMORY_LOG(const std::string &str)
60 {
61  printf("%s", str.c_str());
62  fflush(stdout);
63 }
size_t memory_available()
Definition: mm.cpp:194
MM_register MM_manager
Definition: mm.cpp:475
void MEMORY_LOG(const std::string &str)
Definition: mm_utils.cpp:59
void LOG_avail_memo()
Definition: mm_utils.cpp:45
size_t getAvailableMemory()
Definition: mm_utils.cpp:52