| 25 | } |
| 26 | |
| 27 | void MemReporter::Report(int depth, Entry* entry) |
| 28 | { |
| 29 | String str; |
| 30 | for (int i = 0; i < depth; i++) |
| 31 | str += " "; |
| 32 | |
| 33 | str += entry->mName; |
| 34 | while (str.length() < 64) |
| 35 | str += ' '; |
| 36 | |
| 37 | if (entry->mChildSize == -1) |
| 38 | entry->mChildSize = GetChildSizes(entry); |
| 39 | |
| 40 | if (mShowInKB) |
| 41 | str += StrFormat("%6d %6dk %6dk\r\n", entry->mCount, entry->mSize / 1024, (entry->mSize + entry->mChildSize) / 1024); |
| 42 | else |
| 43 | str += StrFormat("%6d %6d %6d\r\n", entry->mCount, entry->mSize, (entry->mSize + entry->mChildSize)); |
| 44 | BfpOutput_DebugString(str.c_str()); |
| 45 | |
| 46 | Array<Entry*> entries; |
| 47 | for (auto& kv : entry->mChildren) |
| 48 | { |
| 49 | auto* entry = kv.mValue; |
| 50 | entry->mChildSize = GetChildSizes(entry); |
| 51 | entries.Add(kv.mValue); |
| 52 | } |
| 53 | |
| 54 | entries.Sort([](Entry* lhs, Entry* rhs) { return (lhs->mSize + lhs->mChildSize) > (rhs->mSize + rhs->mChildSize); }); |
| 55 | |
| 56 | for (auto& entry : entries) |
| 57 | { |
| 58 | Report(depth + 1, entry); |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | void MemReporter::BeginSection(const StringView& name) |
| 63 | { |
no test coverage detected