Chombo + EB  3.0
memusage.H
Go to the documentation of this file.
1 #ifdef CH_LANG_CC
2 /*
3  * _______ __
4  * / ___/ / ___ __ _ / / ___
5  * / /__/ _ \/ _ \/ V \/ _ \/ _ \
6  * \___/_//_/\___/_/_/_/_.__/\___/
7  * Please refer to Copyright.txt, in Chombo's root directory.
8  */
9 #endif
10 
11 #ifndef _MEMUSAGE_H_
12 #define _MEMUSAGE_H_
13 
14 #include "REAL.H"
15 #include "BaseNamespaceHeader.H"
16 
17 ///
18 /**
19 Print a line of memory information to pout() with a string label
20  */
21 void print_memory_line(const char *);
22 
23 ///
24 /**
25 Print a line of memory information to pout()
26  */
27 void print_memory_line(void);
28 
29 
30 ///
31 /**
32  If Linux, uses /proc/self/status to find the peak residentSetSize of process
33  and the peak VM size. Units should be MB.
34  Returns 0 if not Linux.
35  */
36 void getPeakMemoryFromOS(Real& VmPeak, Real& VmHWM);
37 
38 ///
39 /**
40  Return the residentSetSize of process from either /proc/self/statm or getrusage(RUSAGE_SELF, &rus)
41  Units should be MB.
42  If /proc/self/statm is used (Linux only), then VM size is also returned.
43  */
44 void getMemoryUsageFromOS(Real& residentSetSize, Real& size);
45 
46 ///
47 /**
48  Maintain backward compatibility in code.
49  Return the residentSetSize of process from either /proc/self/statm or getrusage(RUSAGE_SELF, &rus)
50  Units should be MB.
51  */
53 
54 ///
55 /**
56  */
57 void gather_memory_from_procs(Real end_memory,
58  Real &avg_memory,
59  Real &min_memory,
60  Real &max_memory);
61 
62 void reduce_print_avg_min_max(const char* s, Real value);
63 int reduce_avg_min_max(Real value, Real &avg, Real &min, Real &max);
64 int reduce_avg_min_max_loc(Real value, Real& avg, Real& min, Real& max, int& minloc, int& maxloc);
65 
66 #include "BaseNamespaceFooter.H"
67 
68 #endif
void gather_memory_from_procs(Real end_memory, Real &avg_memory, Real &min_memory, Real &max_memory)
IndexTM< T, N > min(const IndexTM< T, N > &a_p1, const IndexTM< T, N > &a_p2)
Definition: IndexTMI.H:396
void getPeakMemoryFromOS(Real &VmPeak, Real &VmHWM)
void print_memory_line(const char *)
double Real
Definition: REAL.H:33
Real get_memory_usage_from_OS(void)
IndexTM< T, N > max(const IndexTM< T, N > &a_p1, const IndexTM< T, N > &a_p2)
Definition: IndexTMI.H:403
int reduce_avg_min_max_loc(Real value, Real &avg, Real &min, Real &max, int &minloc, int &maxloc)
int reduce_avg_min_max(Real value, Real &avg, Real &min, Real &max)
void getMemoryUsageFromOS(Real &residentSetSize, Real &size)
void reduce_print_avg_min_max(const char *s, Real value)