Changeset 4f97937 for src/Common/Stats/Time.h
- Timestamp:
- Mar 4, 2019, 3:52:46 PM (6 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, persistent-indexer, pthread-emulation, qualifiedEnum
- Children:
- 79eaeb7
- Parents:
- 1bb9a9a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/Stats/Time.h
r1bb9a9a r4f97937 18 18 #include "Common/Stats/Base.h" 19 19 20 #if defined( NO_STATISTICS ) 21 #define NO_TIME_STATISTICS 22 #endif 23 20 24 namespace Stats { 21 25 namespace Time { 22 void StartBlock(const char * const name); 23 void StopBlock(); 26 # if defined(NO_TIME_STATISTICS) 27 inline void StartBlock(const char * const) {} 28 inline void StopBlock() {} 24 29 25 void print();30 inline void print() {} 26 31 27 struct BlockGuard {28 BlockGuard(const char * const name ) { StartBlock(name);}29 ~BlockGuard() { StopBlock();}30 };32 struct BlockGuard { 33 BlockGuard(const char * const) {} 34 ~BlockGuard() {} 35 }; 31 36 32 template<typename func_t> 33 void TimeBLock(const char * name, func_t func) { 34 BlockGuard guard(name); 35 func(); 36 } 37 template<typename func_t> 38 inline void TimeBLock(const char *, func_t) {} 39 # else 40 void StartBlock(const char * const name); 41 void StopBlock(); 42 43 void print(); 44 45 struct BlockGuard { 46 BlockGuard(const char * const name ) { StartBlock(name); } 47 ~BlockGuard() { StopBlock(); } 48 }; 49 50 template<typename func_t> 51 inline void TimeBLock(const char * name, func_t func) { 52 BlockGuard guard(name); 53 func(); 54 } 55 # endif 37 56 } 38 57 }
Note: See TracChangeset
for help on using the changeset viewer.