Changeset b38433b for src/Common/Stats/Counter.cc
- Timestamp:
- Mar 5, 2019, 6:17:55 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:
- b830e046, c101756
- Parents:
- 34737de (diff), 972540e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/Stats/Counter.cc
r34737de rb38433b 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // Heap.h--7 // Counter.cc -- 8 8 // 9 9 // Author : Thierry Delisle … … 18 18 #include <algorithm> 19 19 #include <cstring> 20 #include <functional> 20 21 #include <iomanip> 21 22 22 23 namespace Stats { 23 24 namespace Counters { 24 25 template<typename T>26 void ForAllCounters(BaseCounter::list_t & range, size_t level, T func) {27 auto it = range.head;28 while(it) {29 auto next = it->next;30 func(it, level);31 ForAllCounters(it->children, level + 1, func);32 it = next;33 }34 }35 36 25 void print() { 37 if(! BaseCounter::top.head) return;26 if(!top.head) return; 38 27 size_t nc = 0; 39 ForAllCounters(BaseCounter::top, 0, [&](BaseCounter* node, size_t level) {28 Base::ForAll(top, 0, [&](Base::TreeImpl * node, size_t level) { 40 29 nc = std::max(nc, (4 * level) + std::strlen(node->name)); 41 30 }); … … 49 38 50 39 51 ForAllCounters(BaseCounter::top, 0, [&](BaseCounter* node, size_t level) {40 Base::ForAll(top, 0, [&](Base::TreeImpl * node, size_t level) { 52 41 std::cerr << std::string(level * 4, ' '); 53 42 std::cerr << node->name; … … 58 47 std::cerr << " |"; 59 48 std::cerr << '\n'; 60 delete node; 61 }); 49 }, true); 62 50 63 51 std::cerr << std::string(nct, '-') << std::endl; 64 52 } 65 53 66 BaseCounter::list_t BaseCounter::top; 54 Base::TreeTop top; 55 56 extern bool enabled; 67 57 } 68 58 }
Note: See TracChangeset
for help on using the changeset viewer.