Last change
on this file since 2497 was
2426,
checked in by jderouillat, 21 months ago
|
Clean MemCheckcer?, add memory consumption accumulators in main XIOS interfaces for clients, and in the NetCDF interface for servers.
|
-
Property svn:executable set to
*
|
File size:
1.3 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); |
---|
| 17 | void reset(void); |
---|
[2426] | 18 | std::vector<double> getCumulatedMem(void); |
---|
| 19 | static std::vector<double> getMem(void); |
---|
[2425] | 20 | static std::vector<double> getMemories(void); |
---|
[2418] | 21 | static void logMem( std::string id, bool finalizeLog = false ); |
---|
[2212] | 22 | static CMemChecker& get(std::string name); |
---|
| 23 | static std::string getAllCumulatedMem(void) ; |
---|
| 24 | static void disable(void) { enabled_=false ;} |
---|
| 25 | static void enable(void) {enabled_=true ;} |
---|
[2274] | 26 | static void release(void) {allMemChecker_.clear();} |
---|
[2212] | 27 | private: |
---|
| 28 | static void check(void) ; |
---|
[2426] | 29 | std::vector<double> cumulatedMem_; |
---|
| 30 | std::vector<double> lastMem_; |
---|
[2212] | 31 | bool suspended_; |
---|
| 32 | std::string name_; |
---|
| 33 | |
---|
| 34 | static std::map<std::string,CMemChecker> allMemChecker_; |
---|
| 35 | static CMemChecker dummy_ ; |
---|
| 36 | static bool first_ ; |
---|
| 37 | static bool enabled_ ; |
---|
[2418] | 38 | |
---|
| 39 | static double vsize_init_; |
---|
[2425] | 40 | static double rss_init_; |
---|
| 41 | static double vmhwm_init_; |
---|
[2418] | 42 | static double time_init_; |
---|
[2420] | 43 | static std::ofstream fout_; |
---|
| 44 | static int flush_counter_; |
---|
[2212] | 45 | }; |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | |
---|
| 49 | |
---|
| 50 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.