Changeset 1750 for XIOS/dev/dev_ym
- Timestamp:
- 10/18/19 14:30:54 (5 years ago)
- Location:
- XIOS/dev/dev_ym/XIOS_ONE_SIDED/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_ym/XIOS_ONE_SIDED/src/timer.cpp
r1639 r1750 11 11 std::map<std::string,CTimer> CTimer::allTimer; 12 12 13 CTimer::CTimer(const std::string& name_ ) : name(name_)13 CTimer::CTimer(const std::string& name_, bool trace) : name(name_) 14 14 { 15 isTracing_=trace ; 15 16 reset(); 16 17 } … … 25 26 if (!suspended) 26 27 { 27 traceEnd(name);28 if (isTracing_) traceEnd(name); 28 29 cumulatedTime += getTime() - lastTime; 29 30 } … … 36 37 { 37 38 lastTime = getTime(); 38 traceBegin(name);39 if (isTracing_) traceBegin(name); 39 40 } 40 41 suspended = false; … … 52 53 } 53 54 54 CTimer& CTimer::get(const std::string name )55 CTimer& CTimer::get(const std::string name, bool trace) 55 56 { 56 57 std::map<std::string,CTimer>::iterator it = allTimer.find(name); 57 58 if (it == allTimer.end()) 58 it = allTimer.insert(std::make_pair(name, CTimer(name ))).first;59 it = allTimer.insert(std::make_pair(name, CTimer(name,trace))).first; 59 60 return it->second; 60 61 } -
XIOS/dev/dev_ym/XIOS_ONE_SIDED/src/timer.hpp
r1158 r1750 13 13 double lastTime; 14 14 bool suspended; 15 bool isTracing_ ; 15 16 std::string name; 16 17 17 CTimer(const std::string& name );18 CTimer(const std::string& name, bool trace=true); 18 19 void suspend(void); 19 20 void resume(void); … … 22 23 static std::map<std::string,CTimer> allTimer; 23 24 static double getTime(void); 24 static CTimer& get(std::string name );25 static CTimer& get(std::string name, bool trace=true); 25 26 static std::string getAllCumulatedTime(void) ; 26 27 }; -
XIOS/dev/dev_ym/XIOS_ONE_SIDED/src/tracer.cpp
r1657 r1750 25 25 std::map<std::string,int> regionId ; 26 26 int count=0 ; 27 bool traceIsOn=true ; 28 int stackOnOffdeep=0 ; 27 29 28 30 void traceOn(void) 29 31 { 32 stackOnOffdeep-- ; 33 if (stackOnOffdeep!=0) return ; 34 traceIsOn=true; 35 30 36 #if defined(VTRACE) 31 37 VT_ON() ; … … 39 45 void traceOff(void) 40 46 { 47 stackOnOffdeep++ ; 48 if (stackOnOffdeep!=1) return ; 49 traceIsOn=false; 41 50 #if defined(VTRACE) 42 51 VT_OFF() ; … … 51 60 { 52 61 #if defined(VTRACE) 53 VT_USER_START(name.c_str()) ; 62 63 if (traceIsOn) VT_USER_START(name.c_str()) ; 54 64 #elif defined(SCOREP) 55 65 SCOREP_USER_REGION_BY_NAME_BEGIN(name.c_str(),SCOREP_USER_REGION_TYPE_COMMON) … … 76 86 { 77 87 #if defined (VTRACE) 78 VT_USER_END(name.c_str()) ;88 if (traceIsOn) VT_USER_END(name.c_str()) ; 79 89 #elif defined(SCOREP) 80 90 SCOREP_USER_REGION_BY_NAME_END(name.c_str())
Note: See TracChangeset
for help on using the changeset viewer.