Bug 822148 (part 6) - DMD: print block counts in the summary. r=jlebar.

--HG--
extra : rebase_source : 84c3cff46912bc7b9fe3bb4790d2cec874ae3201
This commit is contained in:
Nicholas Nethercote 2012-12-18 19:08:07 -08:00
parent d1e9cbcfac
commit 54dc196b5e
2 changed files with 45 additions and 24 deletions

View File

@ -1911,14 +1911,17 @@ Dump(Writer aWriter)
BlockGroupTable unreportedBlockGroupTable;
(void)unreportedBlockGroupTable.init(1024);
size_t unreportedUsableSize = 0;
size_t unreportedNumBlocks = 0;
BlockGroupTable onceReportedBlockGroupTable;
(void)onceReportedBlockGroupTable.init(1024);
size_t onceReportedUsableSize = 0;
size_t onceReportedNumBlocks = 0;
BlockGroupTable twiceReportedBlockGroupTable;
(void)twiceReportedBlockGroupTable.init(0);
size_t twiceReportedUsableSize = 0;
size_t twiceReportedNumBlocks = 0;
bool anyBlocksSampled = false;
@ -1929,13 +1932,16 @@ Dump(Writer aWriter)
uint32_t numReports = b.NumReports();
if (numReports == 0) {
unreportedUsableSize += b.UsableSize();
unreportedNumBlocks++;
table = &unreportedBlockGroupTable;
} else if (numReports == 1) {
onceReportedUsableSize += b.UsableSize();
onceReportedNumBlocks++;
table = &onceReportedBlockGroupTable;
} else {
MOZ_ASSERT(numReports == 2);
twiceReportedUsableSize += b.UsableSize();
twiceReportedNumBlocks++;
table = &twiceReportedBlockGroupTable;
}
BlockGroupKey key(b);
@ -1950,6 +1956,8 @@ Dump(Writer aWriter)
}
size_t totalUsableSize =
unreportedUsableSize + onceReportedUsableSize + twiceReportedUsableSize;
size_t totalNumBlocks =
unreportedNumBlocks + onceReportedNumBlocks + twiceReportedNumBlocks;
WriteTitle("Invocation\n");
W("$DMD = '%s'\n", gDMDEnvVar);
@ -1974,17 +1982,30 @@ Dump(Writer aWriter)
bool showTilde = anyBlocksSampled;
WriteTitle("Summary\n");
W("Total: %10s bytes\n",
Show(totalUsableSize, gBuf1, kBufLen, showTilde));
W("Unreported: %10s bytes (%5.2f%%)\n",
W("Total: %12s bytes (%6.2f%%) in %7s blocks (%6.2f%%)\n",
Show(totalUsableSize, gBuf1, kBufLen, showTilde),
100.0,
Show(totalNumBlocks, gBuf2, kBufLen, showTilde),
100.0);
W("Unreported: %12s bytes (%6.2f%%) in %7s blocks (%6.2f%%)\n",
Show(unreportedUsableSize, gBuf1, kBufLen, showTilde),
Percent(unreportedUsableSize, totalUsableSize));
W("Once-reported: %10s bytes (%5.2f%%)\n",
Percent(unreportedUsableSize, totalUsableSize),
Show(unreportedNumBlocks, gBuf2, kBufLen, showTilde),
Percent(unreportedNumBlocks, totalNumBlocks));
W("Once-reported: %12s bytes (%6.2f%%) in %7s blocks (%6.2f%%)\n",
Show(onceReportedUsableSize, gBuf1, kBufLen, showTilde),
Percent(onceReportedUsableSize, totalUsableSize));
W("Twice-reported: %10s bytes (%5.2f%%)\n",
Percent(onceReportedUsableSize, totalUsableSize),
Show(onceReportedNumBlocks, gBuf2, kBufLen, showTilde),
Percent(onceReportedNumBlocks, totalNumBlocks));
W("Twice-reported: %12s bytes (%6.2f%%) in %7s blocks (%6.2f%%)\n",
Show(twiceReportedUsableSize, gBuf1, kBufLen, showTilde),
Percent(twiceReportedUsableSize, totalUsableSize));
Percent(twiceReportedUsableSize, totalUsableSize),
Show(twiceReportedNumBlocks, gBuf2, kBufLen, showTilde),
Percent(twiceReportedNumBlocks, totalNumBlocks));
W("\n");

View File

@ -27,10 +27,10 @@ Once-reported blocks
Summary
------------------------------------------------------------------
Total: 0 bytes
Unreported: 0 bytes ( 0.00%)
Once-reported: 0 bytes ( 0.00%)
Twice-reported: 0 bytes ( 0.00%)
Total: 0 bytes (100.00%) in 0 blocks (100.00%)
Unreported: 0 bytes ( 0.00%) in 0 blocks ( 0.00%)
Once-reported: 0 bytes ( 0.00%) in 0 blocks ( 0.00%)
Twice-reported: 0 bytes ( 0.00%) in 0 blocks ( 0.00%)
------------------------------------------------------------------
Invocation
@ -226,10 +226,10 @@ Once-reported: 1 block in block group 11 of 11
Summary
------------------------------------------------------------------
Total: 15,168 bytes
Unreported: 5,328 bytes (35.13%)
Once-reported: 9,568 bytes (63.08%)
Twice-reported: 272 bytes ( 1.79%)
Total: 15,168 bytes (100.00%) in 31 blocks (100.00%)
Unreported: 5,328 bytes ( 35.13%) in 14 blocks ( 45.16%)
Once-reported: 9,568 bytes ( 63.08%) in 13 blocks ( 41.94%)
Twice-reported: 272 bytes ( 1.79%) in 4 blocks ( 12.90%)
------------------------------------------------------------------
Invocation
@ -332,10 +332,10 @@ Once-reported: 1 block in block group 4 of 4
Summary
------------------------------------------------------------------
Total: 2,840 bytes
Unreported: 2,064 bytes (72.68%)
Once-reported: 688 bytes (24.23%)
Twice-reported: 88 bytes ( 3.10%)
Total: 2,840 bytes (100.00%) in 27 blocks (100.00%)
Unreported: 2,064 bytes ( 72.68%) in 21 blocks ( 77.78%)
Once-reported: 688 bytes ( 24.23%) in 4 blocks ( 14.81%)
Twice-reported: 88 bytes ( 3.10%) in 2 blocks ( 7.41%)
------------------------------------------------------------------
Invocation
@ -406,8 +406,8 @@ Once-reported blocks
Summary
------------------------------------------------------------------
Total: ~1,424 bytes
Unreported: ~1,424 bytes (100.00%)
Once-reported: ~0 bytes ( 0.00%)
Twice-reported: ~0 bytes ( 0.00%)
Total: ~1,424 bytes (100.00%) in ~10 blocks (100.00%)
Unreported: ~1,424 bytes (100.00%) in ~10 blocks (100.00%)
Once-reported: ~0 bytes ( 0.00%) in ~0 blocks ( 0.00%)
Twice-reported: ~0 bytes ( 0.00%) in ~0 blocks ( 0.00%)