Changeset 1601 for XIOS/dev/dev_trunk_omp/src/timer.cpp
- Timestamp:
- 11/19/18 15:52:54 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_trunk_omp/src/timer.cpp
r1158 r1601 6 6 #include <sstream> 7 7 #include "tracer.hpp" 8 using namespace ep_lib; 8 9 9 10 namespace xios 10 11 { 11 std::map<std::string,CTimer> CTimer::allTimer;12 std::map<std::string,CTimer> *CTimer::allTimer_ptr = 0; 12 13 13 14 CTimer::CTimer(const std::string& name_) : name(name_) … … 54 55 CTimer& CTimer::get(const std::string name) 55 56 { 56 std::map<std::string,CTimer>::iterator it = allTimer.find(name); 57 if (it == allTimer.end()) 58 it = allTimer.insert(std::make_pair(name, CTimer(name))).first; 57 if(allTimer_ptr == NULL) allTimer_ptr = new std::map<std::string,CTimer>; 58 59 std::map<std::string,CTimer>::iterator it = allTimer_ptr->find(name); 60 61 if (it == allTimer_ptr->end()) 62 it = allTimer_ptr->insert(std::make_pair(name, CTimer(name))).first; 63 59 64 return it->second; 60 65 } … … 63 68 { 64 69 std::ostringstream strOut ; 65 for(std::map<std::string,CTimer>::iterator it=allTimer.begin();it!=allTimer.end();++it) 70 if(allTimer_ptr == 0) allTimer_ptr = new std::map<std::string,CTimer>; 71 72 for(std::map<std::string,CTimer>::iterator it=allTimer_ptr->begin();it!=allTimer_ptr->end();++it) 66 73 strOut<<"Timer : "<<it->first<<" --> cumulated time : "<<it->second.getCumulatedTime()<<std::endl ; 67 74 return strOut.str() ;
Note: See TracChangeset
for help on using the changeset viewer.