Changeset 4f97937 for src/Common
- 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
- Location:
- src/Common
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/Stats/Base.h
r1bb9a9a r4f97937 16 16 #pragma once 17 17 18 #include <cstdint> 19 #include <iostream> 20 18 21 namespace Stats { 19 22 namespace Base { … … 28 31 29 32 template<typename func_t> 30 void ForAll(TreeTop & range, s ize_t level, func_t func, bool destroy = false);33 void ForAll(TreeTop & range, std::size_t level, func_t func, bool destroy = false); 31 34 32 35 class TreeImpl { … … 46 49 47 50 template<typename func_t> 48 friend void ForAll(TreeTop & range, s ize_t level, func_t func, bool destroy);51 friend void ForAll(TreeTop & range, std::size_t level, func_t func, bool destroy); 49 52 }; 50 53 … … 56 59 57 60 template<typename func_t> 58 inline void ForAll(TreeTop & range, s ize_t level, func_t func, bool destroy) {61 inline void ForAll(TreeTop & range, std::size_t level, func_t func, bool destroy) { 59 62 auto it = range.head; 60 63 while(it) { -
src/Common/Stats/Stats.cc
r1bb9a9a r4f97937 32 32 namespace Time { 33 33 bool enabled = false; 34 void print() {}34 void print(); 35 35 } 36 36 -
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 } -
src/Common/module.mk
r1bb9a9a r4f97937 23 23 Common/Stats/Heap.cc \ 24 24 Common/Stats/Stats.cc \ 25 Common/Stats/Time.cc \ 25 26 Common/UniqueName.cc 26 27
Note: See TracChangeset
for help on using the changeset viewer.