From ae01c120df75bc78eca0c3b10125a12343116307 Mon Sep 17 00:00:00 2001 From: "warren%netscape.com" Date: Fri, 29 Oct 1999 18:48:37 +0000 Subject: [PATCH] Fixed round-off error computing bloat total. --- xpcom/base/nsTraceRefcnt.cpp | 8 ++++---- xpcom/base/nsTraceRefcntImpl.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/xpcom/base/nsTraceRefcnt.cpp b/xpcom/base/nsTraceRefcnt.cpp index 68542f271a0a..cb4b3a40df96 100644 --- a/xpcom/base/nsTraceRefcnt.cpp +++ b/xpcom/base/nsTraceRefcnt.cpp @@ -223,7 +223,7 @@ public: BloatEntry* entry = (BloatEntry*)he->value; GatherArgs* ga = (GatherArgs*) arg; if (arg && entry && ga->func) { - PRBool stop = (*ga->func)(entry->mClassName, entry->mClassSize, + PRBool stop = (*ga->func)(entry->mClassName, (PRUint32)entry->mClassSize, &entry->mNewStats, &entry->mAllStats, ga->closure); if (stop) { @@ -274,8 +274,8 @@ public: stddevObjs != 0) { fprintf(out, "%4d %-20.20s %8d %8d %8d %8d (%8.2f +/- %8.2f) %8d %8d (%8.2f +/- %8.2f)\n", i+1, mClassName, - mClassSize, - (stats->mCreates - stats->mDestroys) * mClassSize, + (PRInt32)mClassSize, + (PRInt32)((stats->mCreates - stats->mDestroys) * mClassSize), stats->mCreates, (stats->mCreates - stats->mDestroys), meanObjs, @@ -290,7 +290,7 @@ public: protected: const char* mClassName; - PRUint32 mClassSize; + double mClassSize; // this is stored as a double because of the way we compute the avg class size for total bloat nsTraceRefcntStats mNewStats; nsTraceRefcntStats mAllStats; }; diff --git a/xpcom/base/nsTraceRefcntImpl.cpp b/xpcom/base/nsTraceRefcntImpl.cpp index 68542f271a0a..cb4b3a40df96 100644 --- a/xpcom/base/nsTraceRefcntImpl.cpp +++ b/xpcom/base/nsTraceRefcntImpl.cpp @@ -223,7 +223,7 @@ public: BloatEntry* entry = (BloatEntry*)he->value; GatherArgs* ga = (GatherArgs*) arg; if (arg && entry && ga->func) { - PRBool stop = (*ga->func)(entry->mClassName, entry->mClassSize, + PRBool stop = (*ga->func)(entry->mClassName, (PRUint32)entry->mClassSize, &entry->mNewStats, &entry->mAllStats, ga->closure); if (stop) { @@ -274,8 +274,8 @@ public: stddevObjs != 0) { fprintf(out, "%4d %-20.20s %8d %8d %8d %8d (%8.2f +/- %8.2f) %8d %8d (%8.2f +/- %8.2f)\n", i+1, mClassName, - mClassSize, - (stats->mCreates - stats->mDestroys) * mClassSize, + (PRInt32)mClassSize, + (PRInt32)((stats->mCreates - stats->mDestroys) * mClassSize), stats->mCreates, (stats->mCreates - stats->mDestroys), meanObjs, @@ -290,7 +290,7 @@ public: protected: const char* mClassName; - PRUint32 mClassSize; + double mClassSize; // this is stored as a double because of the way we compute the avg class size for total bloat nsTraceRefcntStats mNewStats; nsTraceRefcntStats mAllStats; };