Bug 1073594, part 3 - Remove the mean and stddev for BloatLog object counts. r=dbaron
authorAndrew McCreight <continuation@gmail.com>
Wed, 04 Mar 2015 14:07:59 -0800
changeset 231924 ac6e3fccc155442c12875b856e48e0c9e4bcb094
parent 231923 25e5a9346a6af24861e7daf853e49519e18d3b99
child 231925 505dc97789f0f5658866c8dadafa31b42d9875d0
push id28364
push usercbook@mozilla.com
push dateThu, 05 Mar 2015 14:12:01 +0000
treeherdermozilla-central@fa59461863f5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1073594
milestone39.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 1073594, part 3 - Remove the mean and stddev for BloatLog object counts. r=dbaron
xpcom/base/nsTraceRefcnt.cpp
--- a/xpcom/base/nsTraceRefcnt.cpp
+++ b/xpcom/base/nsTraceRefcnt.cpp
@@ -36,40 +36,16 @@
 #include "mozilla/PoisonIOInterposer.h"
 
 #ifdef HAVE_DLOPEN
 #include <dlfcn.h>
 #endif
 
 ////////////////////////////////////////////////////////////////////////////////
 
-void
-NS_MeanAndStdDev(double aNumberOfValues,
-                 double aSumOfValues, double aSumOfSquaredValues,
-                 double* aMeanResult, double* aStdDevResult)
-{
-  double mean = 0.0, var = 0.0, stdDev = 0.0;
-  if (aNumberOfValues > 0.0 && aSumOfValues >= 0) {
-    mean = aSumOfValues / aNumberOfValues;
-    double temp =
-      (aNumberOfValues * aSumOfSquaredValues) - (aSumOfValues * aSumOfValues);
-    if (temp < 0.0 || aNumberOfValues <= 1) {
-      var = 0.0;
-    } else {
-      var = temp / (aNumberOfValues * (aNumberOfValues - 1));
-    }
-    // for some reason, Windows says sqrt(0.0) is "-1.#J" (?!) so do this:
-    stdDev = var != 0.0 ? sqrt(var) : 0.0;
-  }
-  *aMeanResult = mean;
-  *aStdDevResult = stdDev;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-
 #define NS_IMPL_REFCNT_LOGGING
 
 #ifdef NS_IMPL_REFCNT_LOGGING
 #include "plhash.h"
 #include "prmem.h"
 
 #include "prlock.h"
 
@@ -383,55 +359,44 @@ public:
     nsTraceRefcntStats& stats =
       (aType == nsTraceRefcnt::NEW_STATS) ? mNewStats : mAllStats;
     if (gLogLeaksOnly && !HaveLeaks(&stats)) {
       return false;
     }
 
     fprintf(aOut,
             "\n" \
-            "     |<----------------Class--------------->|<-----Bytes------>|<----------------Objects---------------->|<---References-->|\n" \
-            "                                              Per-Inst   Leaked    Total      Rem      Mean       StdDev     Total      Rem\n");
+            "     |<----------------Class--------------->|<-----Bytes------>|<----Objects---->|<--References--->|\n" \
+            "                                              Per-Inst   Leaked    Total      Rem    Total      Rem\n");
 
     this->DumpTotal(aOut);
 
     return true;
   }
 
   void Dump(int aIndex, FILE* aOut, nsTraceRefcnt::StatisticsType aType)
   {
     nsTraceRefcntStats* stats =
       (aType == nsTraceRefcnt::NEW_STATS) ? &mNewStats : &mAllStats;
     if (gLogLeaksOnly && !HaveLeaks(stats)) {
       return;
     }
 
-    double meanObjs;
-    double stddevObjs;
-    NS_MeanAndStdDev(stats->mCreates + stats->mDestroys,
-                     stats->mObjsOutstandingTotal,
-                     stats->mObjsOutstandingSquared,
-                     &meanObjs, &stddevObjs);
-
     if ((stats->mAddRefs - stats->mReleases) != 0 ||
         stats->mAddRefs != 0 ||
         (stats->mCreates - stats->mDestroys) != 0 ||
-        stats->mCreates != 0 ||
-        meanObjs != 0 ||
-        stddevObjs != 0) {
-      fprintf(aOut, "%4d %-40.40s %8d %8" PRIu64 " %8" PRIu64 " %8" PRIu64 " (%8.2f +/- %8.2f) %8" PRIu64 " %8" PRIu64 "\n",
+        stats->mCreates != 0) {
+      fprintf(aOut, "%4d %-40.40s %8d %8" PRIu64 " %8" PRIu64 " %8" PRIu64 " %8" PRIu64 " %8" PRIu64 "\n",
               aIndex + 1, mClassName,
               (int32_t)mClassSize,
               (nsCRT::strcmp(mClassName, "TOTAL"))
                 ? (uint64_t)((stats->mCreates - stats->mDestroys) * mClassSize)
                 : mTotalLeaked,
               stats->mCreates,
               (stats->mCreates - stats->mDestroys),
-              meanObjs,
-              stddevObjs,
               stats->mAddRefs,
               (stats->mAddRefs - stats->mReleases));
     }
   }
 
 protected:
   char*         mClassName;
   double        mClassSize;     // this is stored as a double because of the way we compute the avg class size for total bloat