Last change
on this file since 2425 was
2425,
checked in by jderouillat, 17 months ago
|
Update the memory log system to log virtual memory, resident memory and resident peak memory
|
-
Property svn:executable set to
*
|
File size:
1.4 KB
|
Line | |
---|
1 | #ifndef __XIOS_MEM_CHECKER_HPP__ |
---|
2 | #define __XIOS_MEM_CHECKER_HPP__ |
---|
3 | |
---|
4 | #include <string> |
---|
5 | #include <map> |
---|
6 | #include <fstream> |
---|
7 | #include <vector> |
---|
8 | |
---|
9 | namespace xios |
---|
10 | { |
---|
11 | class CMemChecker |
---|
12 | { |
---|
13 | public: |
---|
14 | CMemChecker(const std::string& name); |
---|
15 | void suspend(void); |
---|
16 | void resume(void); |
---|
17 | void suspendRSS(void); |
---|
18 | void resumeRSS(void); |
---|
19 | void reset(void); |
---|
20 | double getCumulatedMem(void); |
---|
21 | static double getMem(void); |
---|
22 | static double getMemRSS(void); |
---|
23 | static std::vector<double> getMemories(void); |
---|
24 | static void logMem( std::string id, bool finalizeLog = false ); |
---|
25 | static CMemChecker& get(std::string name); |
---|
26 | static std::string getAllCumulatedMem(void) ; |
---|
27 | static void disable(void) { enabled_=false ;} |
---|
28 | static void enable(void) {enabled_=true ;} |
---|
29 | static void release(void) {allMemChecker_.clear();} |
---|
30 | private: |
---|
31 | static void check(void) ; |
---|
32 | double cumulatedMem_; |
---|
33 | double lastMem_; |
---|
34 | bool suspended_; |
---|
35 | std::string name_; |
---|
36 | |
---|
37 | static std::map<std::string,CMemChecker> allMemChecker_; |
---|
38 | static CMemChecker dummy_ ; |
---|
39 | static bool first_ ; |
---|
40 | static bool enabled_ ; |
---|
41 | |
---|
42 | static double vsize_init_; |
---|
43 | static double rss_init_; |
---|
44 | static double vmhwm_init_; |
---|
45 | static double time_init_; |
---|
46 | static std::ofstream fout_; |
---|
47 | static int flush_counter_; |
---|
48 | }; |
---|
49 | } |
---|
50 | |
---|
51 | |
---|
52 | |
---|
53 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.