- Timestamp:
- May 3, 2018, 5:15:41 PM (6 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, with_gc
- Children:
- a96691d
- Parents:
- 01690b7
- Location:
- src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/Heap.cc
r01690b7 recaeac6e 14 14 // 15 15 16 #include <cassert> 17 #include <cmath> 16 18 #include <cstddef> 17 #include <c assert>19 #include <cstring> 18 20 #include <iomanip> 19 21 #include <iostream> … … 45 47 46 48 void printStats() { 47 std::cerr << "Heap usage statistic:" << std::endl; 48 std::cerr << "Pass | Malloc Count | Free Count" << std::endl; 49 size_t nc = 0; 49 50 for(size_t i = 0; i < passes_cnt; i++) { 50 std::cerr << std::setw(20) << passes[i].name << " | "; 51 nc = std::max(nc, std::strlen(passes[i].name)); 52 } 53 54 const char * const title = "Heap Usage Statistic"; 55 for(size_t i = 0; i < (nc + 30); i++) std::cerr << '='; std::cerr << '\n'; 56 for(size_t i = 0; i < (nc + 30 - std::strlen(title)) / 2; i++) std::cerr << ' '; 57 std::cerr << title << std::endl; 58 for(size_t i = 0; i < (nc + 30); i++) std::cerr << '-'; std::cerr << '\n'; 59 std::cerr << std::setw(nc) << "Pass"; 60 std::cerr << " | Malloc Count | Free Count" << std::endl; 61 for(size_t i = 0; i < (nc + 30); i++) std::cerr << '-'; std::cerr << '\n'; 62 for(size_t i = 0; i < passes_cnt; i++) { 63 std::cerr << std::setw(nc) << passes[i].name << " | "; 51 64 std::cerr << std::setw(12) << passes[i].mallocs << " | "; 52 65 std::cerr << std::setw(12) << passes[i].frees << "\n"; -
src/main.cc
r01690b7 recaeac6e 64 64 65 65 #define PASS(name, pass) \ 66 if ( errorp ) { cerr << #name << endl; } \67 HeapStats::newPass( #name); \66 if ( errorp ) { cerr << name << endl; } \ 67 HeapStats::newPass(name); \ 68 68 pass; 69 69
Note: See TracChangeset
for help on using the changeset viewer.