Last change
on this file since 2425 was
2425,
checked in by jderouillat, 19 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
|
Rev | Line | |
---|
[2212] | 1 | #ifndef __XIOS_MEM_CHECKER_HPP__ |
---|
| 2 | #define __XIOS_MEM_CHECKER_HPP__ |
---|
| 3 | |
---|
| 4 | #include <string> |
---|
| 5 | #include <map> |
---|
[2420] | 6 | #include <fstream> |
---|
[2425] | 7 | #include <vector> |
---|
[2212] | 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); |
---|
[2418] | 17 | void suspendRSS(void); |
---|
| 18 | void resumeRSS(void); |
---|
[2212] | 19 | void reset(void); |
---|
| 20 | double getCumulatedMem(void); |
---|
| 21 | static double getMem(void); |
---|
[2418] | 22 | static double getMemRSS(void); |
---|
[2425] | 23 | static std::vector<double> getMemories(void); |
---|
[2418] | 24 | static void logMem( std::string id, bool finalizeLog = false ); |
---|
[2212] | 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 ;} |
---|
[2274] | 29 | static void release(void) {allMemChecker_.clear();} |
---|
[2212] | 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_ ; |
---|
[2418] | 41 | |
---|
| 42 | static double vsize_init_; |
---|
[2425] | 43 | static double rss_init_; |
---|
| 44 | static double vmhwm_init_; |
---|
[2418] | 45 | static double time_init_; |
---|
[2420] | 46 | static std::ofstream fout_; |
---|
| 47 | static int flush_counter_; |
---|
[2212] | 48 | }; |
---|
| 49 | } |
---|
| 50 | |
---|
| 51 | |
---|
| 52 | |
---|
| 53 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.