Bug 841564 - DMD: Fix the second percentage in stack frame records. r=jlebar. DONTBUILD.
authorNicholas Nethercote <nnethercote@mozilla.com>
Mon, 18 Feb 2013 17:02:13 -0800
changeset 122295 0fa9eb04723292cf58cab64c302824d5d3a4bc64
parent 122294 c36791017011317b5471bd63d6c818a69f2fcdcf
child 122296 44ffa1083d55f26c29b822f734f286ae8df4c539
push id24332
push userryanvm@gmail.com
push dateTue, 19 Feb 2013 13:42:49 +0000
treeherdermozilla-central@cc37417e2c28 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlebar
bugs841564
milestone21.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 841564 - DMD: Fix the second percentage in stack frame records. r=jlebar. DONTBUILD.
memory/replace/dmd/DMD.cpp
memory/replace/dmd/test-expected.dmd
--- a/memory/replace/dmd/DMD.cpp
+++ b/memory/replace/dmd/DMD.cpp
@@ -262,18 +262,16 @@ Plural(size_t aN)
 
 // Used by calls to Show().
 static const size_t kBufLen = 64;
 static char gBuf1[kBufLen];
 static char gBuf2[kBufLen];
 static char gBuf3[kBufLen];
 static char gBuf4[kBufLen];
 
-static const size_t kNoSize = size_t(-1);
-
 //---------------------------------------------------------------------------
 // Options (Part 1)
 //---------------------------------------------------------------------------
 
 class Options
 {
   template <typename T>
   struct NumOption
@@ -1442,17 +1440,19 @@ public:
 
   // This is |const| thanks to the |mutable| fields above.
   void Add(const Block& aB) const
   {
     mNumBlocks++;
     mRecordSize.Add(aB);
   }
 
-  static const char* const kRecordKind;   // for PrintSortedRecords
+  // For PrintSortedRecords.
+  static const char* const kRecordKind;
+  static bool recordsOverlap() { return false; }
 
   void Print(const Writer& aWriter, LocationService* aLocService,
              uint32_t aM, uint32_t aN, const char* aStr, const char* astr,
              size_t aCategoryUsableSize, size_t aCumulativeUsableSize,
              size_t aTotalUsableSize) const;
 
   static int QsortCmp(const void* aA, const void* aB)
   {
@@ -1551,17 +1551,19 @@ public:
   static int QsortCmp(const void* aA, const void* aB)
   {
     const FrameRecord* const a = *static_cast<const FrameRecord* const*>(aA);
     const FrameRecord* const b = *static_cast<const FrameRecord* const*>(aB);
 
     return RecordSize::Cmp(a->mRecordSize, b->mRecordSize);
   }
 
-  static const char* const kRecordKind;   // for PrintSortedRecords
+  // For PrintSortedRecords.
+  static const char* const kRecordKind;
+  static bool recordsOverlap() { return true; }
 
   // Hash policy.
 
   typedef const void* Lookup;
 
   static uint32_t hash(const void* const& aPc)
   {
     return mozilla::HashGeneric(aPc);
@@ -1935,18 +1937,19 @@ PrintSortedRecords(const Writer& aWriter
       r->Print(aWriter, aLocService, i+1, numRecords, aStr, astr,
                aCategoryUsableSize, cumulativeUsableSize, aTotalUsableSize);
     } else if (i == maxRecords) {
       W("%s: stopping after %s stack %s records\n\n", aStr,
         Show(maxRecords, gBuf1, kBufLen), kind);
     }
   }
 
-  MOZ_ASSERT(aCategoryUsableSize == kNoSize ||
-             aCategoryUsableSize == cumulativeUsableSize);
+  // This holds for TraceRecords, but not for FrameRecords.
+  MOZ_ASSERT_IF(!Record::recordsOverlap(),
+                aCategoryUsableSize == cumulativeUsableSize);
 }
 
 static void
 PrintSortedTraceAndFrameRecords(const Writer& aWriter,
                                 LocationService* aLocService,
                                 const char* aStr, const char* astr,
                                 const TraceRecordTable& aTraceRecordTable,
                                 size_t aCategoryUsableSize,
@@ -1978,18 +1981,19 @@ PrintSortedTraceAndFrameRecords(const Wr
       FrameRecordTable::AddPtr p = frameRecordTable.lookupForAdd(pc);
       if (!p) {
         FrameRecord fr(pc);
         (void)frameRecordTable.add(p, fr);
       }
       p->Add(tr);
     }
   }
+
   PrintSortedRecords(aWriter, aLocService, aStr, astr, frameRecordTable,
-                     kNoSize, aTotalUsableSize);
+                     aCategoryUsableSize, aTotalUsableSize);
 }
 
 // Note that, unlike most SizeOf* functions, this function does not take a
 // |nsMallocSizeOfFun| argument.  That's because those arguments are primarily
 // to aid DMD track heap blocks... but DMD deliberately doesn't track heap
 // blocks it allocated for itself!
 //
 // SizeOfInternal should be called while you're holding the state lock and while
--- a/memory/replace/dmd/test-expected.dmd
+++ b/memory/replace/dmd/test-expected.dmd
@@ -126,29 +126,29 @@ Unreported: 2 blocks in stack trace reco
    ... RunTestMode ... DMD.cpp
 
 ------------------------------------------------------------------
 Unreported stack frame records
 ------------------------------------------------------------------
 
 Unreported: 9 blocks from 1 stack trace record in stack frame record M of N
  1,008 bytes (900 requested / 108 slop)
- 8.34% of the heap;  0.00% of unreported
+ 8.34% of the heap;  81.82% of unreported
  PC is
    ... RunTestMode ... DMD.cpp
 
 Unreported: 2 blocks from 1 stack trace record in stack frame record M of N
  112 bytes (112 requested / 0 slop)
- 0.93% of the heap;  0.00% of unreported
+ 0.93% of the heap;  9.09% of unreported
  PC is
    ... RunTestMode ... DMD.cpp
 
 Unreported: 2 blocks from 1 stack trace record in stack frame record M of N
  112 bytes (112 requested / 0 slop)
- 0.93% of the heap;  0.00% of unreported
+ 0.93% of the heap;  9.09% of unreported
  PC is
    ... RunTestMode ... DMD.cpp
 
 ------------------------------------------------------------------
 Once-reported stack trace records
 ------------------------------------------------------------------
 
 Once-reported: 1 block in stack trace record 1 of 11
@@ -251,53 +251,53 @@ Once-reported: 1 block in stack trace re
    ... RunTestMode ... DMD.cpp
 
 ------------------------------------------------------------------
 Once-reported stack frame records
 ------------------------------------------------------------------
 
 Once-reported: 1 block from 1 stack trace record in stack frame record M of N
  8,192 bytes (4,097 requested / 4,095 slop)
- 67.77% of the heap;  0.00% of once-reported
+ 67.77% of the heap;  77.40% of once-reported
  PC is
    ... RunTestMode ... DMD.cpp
 
 Once-reported: 1 block from 1 stack trace record in stack frame record M of N
  1,024 bytes (1,023 requested / 1 slop)
- 8.47% of the heap;  0.00% of once-reported
+ 8.47% of the heap;  9.67% of once-reported
  PC is
    ... RunTestMode ... DMD.cpp
 
 Once-reported: 1 block from 1 stack trace record in stack frame record M of N
  512 bytes (512 requested / 0 slop)
- 4.24% of the heap;  0.00% of once-reported
+ 4.24% of the heap;  4.84% of once-reported
  PC is
    ... RunTestMode ... DMD.cpp
 
 Once-reported: 4 blocks from 3 stack trace records in stack frame record M of N
  416 bytes (416 requested / 0 slop)
- 3.44% of the heap;  0.00% of once-reported
+ 3.44% of the heap;  3.93% of once-reported
  PC is
    ... RunTestMode ... DMD.cpp
 
 Once-reported: 4 blocks from 3 stack trace records in stack frame record M of N
  416 bytes (416 requested / 0 slop)
- 3.44% of the heap;  0.00% of once-reported
+ 3.44% of the heap;  3.93% of once-reported
  PC is
    ... RunTestMode ... DMD.cpp
 
 Once-reported: 1 block from 1 stack trace record in stack frame record M of N
  16 bytes (10 requested / 6 slop)
- 0.13% of the heap;  0.00% of once-reported
+ 0.13% of the heap;  0.15% of once-reported
  PC is
    ... RunTestMode ... DMD.cpp
 
 Once-reported: 1 block from 1 stack trace record in stack frame record M of N
  8 bytes (0 requested / 8 slop)
- 0.07% of the heap;  0.00% of once-reported
+ 0.07% of the heap;  0.08% of once-reported
  PC is
    ... RunTestMode ... DMD.cpp
 
 ------------------------------------------------------------------
 Summary
 ------------------------------------------------------------------
 
 Total:                12,088 bytes (100.00%) in      30 blocks (100.00%)
@@ -363,29 +363,29 @@ Unreported: 6 blocks in stack trace reco
    ... RunTestMode ... DMD.cpp
 
 ------------------------------------------------------------------
 Unreported stack frame records
 ------------------------------------------------------------------
 
 Unreported: 9 blocks from 1 stack trace record in stack frame record M of N
  1,008 bytes (900 requested / 108 slop)
- 35.49% of the heap;  0.00% of unreported
+ 35.49% of the heap;  48.84% of unreported
  PC is
    ... RunTestMode ... DMD.cpp
 
 Unreported: 6 blocks from 1 stack trace record in stack frame record M of N
  528 bytes (528 requested / 0 slop)
- 18.59% of the heap;  0.00% of unreported
+ 18.59% of the heap;  25.58% of unreported
  PC is
    ... RunTestMode ... DMD.cpp
 
 Unreported: 6 blocks from 1 stack trace record in stack frame record M of N
  528 bytes (528 requested / 0 slop)
- 18.59% of the heap;  0.00% of unreported
+ 18.59% of the heap;  25.58% of unreported
  PC is
    ... RunTestMode ... DMD.cpp
 
 ------------------------------------------------------------------
 Once-reported stack trace records
 ------------------------------------------------------------------
 
 Once-reported: 1 block in stack trace record 1 of 4
@@ -425,35 +425,35 @@ Once-reported: 1 block in stack trace re
    ... RunTestMode ... DMD.cpp
 
 ------------------------------------------------------------------
 Once-reported stack frame records
 ------------------------------------------------------------------
 
 Once-reported: 1 block from 1 stack trace record in stack frame record M of N
  512 bytes (512 requested / 0 slop)
- 18.03% of the heap;  0.00% of once-reported
+ 18.03% of the heap;  74.42% of once-reported
  PC is
    ... RunTestMode ... DMD.cpp
 
 Once-reported: 1 block from 1 stack trace record in stack frame record M of N
  80 bytes (79 requested / 1 slop)
- 2.82% of the heap;  0.00% of once-reported
+ 2.82% of the heap;  11.63% of once-reported
  PC is
    ... RunTestMode ... DMD.cpp
 
 Once-reported: 1 block from 1 stack trace record in stack frame record M of N
  80 bytes (78 requested / 2 slop)
- 2.82% of the heap;  0.00% of once-reported
+ 2.82% of the heap;  11.63% of once-reported
  PC is
    ... RunTestMode ... DMD.cpp
 
 Once-reported: 1 block from 1 stack trace record in stack frame record M of N
  16 bytes (10 requested / 6 slop)
- 0.56% of the heap;  0.00% of once-reported
+ 0.56% of the heap;  2.33% of once-reported
  PC is
    ... RunTestMode ... DMD.cpp
 
 ------------------------------------------------------------------
 Summary
 ------------------------------------------------------------------
 
 Total:                 2,840 bytes (100.00%) in      27 blocks (100.00%)
@@ -521,53 +521,53 @@ Unreported: ~1 block in stack trace reco
    ... RunTestMode ... DMD.cpp
 
 ------------------------------------------------------------------
 Unreported stack frame records
 ------------------------------------------------------------------
 
 Unreported: ~4 blocks from ~1 stack trace record in stack frame record M of N
  ~512 bytes (~512 requested / ~0 slop)
- 35.96% of the heap;  0.00% of unreported
+ 35.96% of the heap;  35.96% of unreported
  PC is
    ... RunTestMode ... DMD.cpp
 
 Unreported: 1 block from 1 stack trace record in stack frame record M of N
  256 bytes (256 requested / 0 slop)
- 17.98% of the heap;  0.00% of unreported
+ 17.98% of the heap;  17.98% of unreported
  PC is
    ... RunTestMode ... DMD.cpp
 
 Unreported: 1 block from 1 stack trace record in stack frame record M of N
  144 bytes (144 requested / 0 slop)
- 10.11% of the heap;  0.00% of unreported
+ 10.11% of the heap;  10.11% of unreported
  PC is
    ... RunTestMode ... DMD.cpp
 
 Unreported: 1 block from 1 stack trace record in stack frame record M of N
  128 bytes (128 requested / 0 slop)
- 8.99% of the heap;  0.00% of unreported
+ 8.99% of the heap;  8.99% of unreported
  PC is
    ... RunTestMode ... DMD.cpp
 
 Unreported: ~1 block from ~1 stack trace record in stack frame record M of N
  ~128 bytes (~128 requested / ~0 slop)
- 8.99% of the heap;  0.00% of unreported
+ 8.99% of the heap;  8.99% of unreported
  PC is
    ... RunTestMode ... DMD.cpp
 
 Unreported: ~1 block from ~1 stack trace record in stack frame record M of N
  ~128 bytes (~128 requested / ~0 slop)
- 8.99% of the heap;  0.00% of unreported
+ 8.99% of the heap;  8.99% of unreported
  PC is
    ... RunTestMode ... DMD.cpp
 
 Unreported: ~1 block from ~1 stack trace record in stack frame record M of N
  ~128 bytes (~128 requested / ~0 slop)
- 8.99% of the heap;  0.00% of unreported
+ 8.99% of the heap;  8.99% of unreported
  PC is
    ... RunTestMode ... DMD.cpp
 
 ------------------------------------------------------------------
 Once-reported stack trace records
 ------------------------------------------------------------------
 
 (none)