| 104 | } |
| 105 | |
| 106 | void gcReportHistogram ( const gc_root & root, const char * label, TextWriter & out, uint64_t minCount ) { |
| 107 | Histogram histo; |
| 108 | gc_build_histogram(root, histo); |
| 109 | // files, descending by total count |
| 110 | vector<const pair<const string, FileBucket>*> files; |
| 111 | for ( auto & kv : histo ) files.push_back(&kv); |
| 112 | sort(files.begin(), files.end(), |
| 113 | [](const pair<const string, FileBucket>* a, const pair<const string, FileBucket>* b){ |
| 114 | return a->second.total.total > b->second.total.total; |
| 115 | }); |
| 116 | out << "=== AST gc histogram: " << (label ? label : "") << " — " << root.gc_count << " nodes ===\n"; |
| 117 | for ( auto fp : files ) { |
| 118 | if ( fp->second.total.total < minCount ) continue; |
| 119 | out << " " << fp->first << " " << fp->second.total.total << " "; |
| 120 | gc_format_breakdown(fp->second.total, out); |
| 121 | out << "\n"; |
| 122 | vector<const pair<const uint32_t, TagCounts>*> lines; |
| 123 | for ( auto & lkv : fp->second.byLine ) lines.push_back(&lkv); |
| 124 | sort(lines.begin(), lines.end(), |
| 125 | [](const pair<const uint32_t, TagCounts>* a, const pair<const uint32_t, TagCounts>* b){ |
| 126 | return a->second.total > b->second.total; |
| 127 | }); |
| 128 | for ( auto lp : lines ) { |
| 129 | if ( lp->second.total < minCount ) continue; |
| 130 | out << " :" << lp->first << " " << lp->second.total << " "; |
| 131 | gc_format_breakdown(lp->second, out); |
| 132 | out << "\n"; |
| 133 | } |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | // ---- per-stage delta ---- |
| 138 |
no test coverage detected