diff --git a/xpcom/base/nsMemoryReporterManager.cpp b/xpcom/base/nsMemoryReporterManager.cpp index 3b470b9ae16..c18a6bc87e6 100644 --- a/xpcom/base/nsMemoryReporterManager.cpp +++ b/xpcom/base/nsMemoryReporterManager.cpp @@ -59,22 +59,19 @@ static nsresult GetProcSelfStatmField(int aField, int64_t* aN) } #define HAVE_VSIZE_AND_RESIDENT_REPORTERS 1 -static nsresult -VsizeDistinguishedAmount(int64_t* aN) +static nsresult GetVsize(int64_t* aN) { return GetProcSelfStatmField(0, aN); } -static nsresult -ResidentDistinguishedAmount(int64_t* aN) +static nsresult GetResident(int64_t* aN) { return GetProcSelfStatmField(1, aN); } -static nsresult -ResidentFastDistinguishedAmount(int64_t* aN) +static nsresult GetResidentFast(int64_t* aN) { - return ResidentDistinguishedAmount(aN); + return GetResident(aN); } #define HAVE_RESIDENT_UNIQUE_REPORTER @@ -175,8 +172,7 @@ static nsresult GetKinfoProcSelf(KINFO_PROC* aProc) } #define HAVE_VSIZE_AND_RESIDENT_REPORTERS 1 -static nsresult -VsizeDistinguishedAmount(int64_t* aN) +static nsresult GetVsize(int64_t* aN) { KINFO_PROC proc; nsresult rv = GetKinfoProcSelf(&proc); @@ -186,8 +182,7 @@ VsizeDistinguishedAmount(int64_t* aN) return rv; } -static nsresult -ResidentDistinguishedAmount(int64_t* aN) +static nsresult GetResident(int64_t* aN) { KINFO_PROC proc; nsresult rv = GetKinfoProcSelf(&proc); @@ -197,10 +192,9 @@ ResidentDistinguishedAmount(int64_t* aN) return rv; } -static nsresult -ResidentFastDistinguishedAmount(int64_t* aN) +static nsresult GetResidentFast(int64_t* aN) { - return ResidentDistinguishedAmount(aN); + return GetResident(aN); } #elif defined(SOLARIS) @@ -251,8 +245,7 @@ static void XMappingIter(int64_t& vsize, int64_t& resident) } #define HAVE_VSIZE_AND_RESIDENT_REPORTERS 1 -static nsresult -VsizeDistinguishedAmount(int64_t* aN) +static nsresult GetVsize(int64_t* aN) { int64_t vsize, resident; XMappingIter(vsize, resident); @@ -263,8 +256,7 @@ VsizeDistinguishedAmount(int64_t* aN) return NS_OK; } -static nsresult -ResidentDistinguishedAmount(int64_t* aN) +static nsresult GetResident(int64_t* aN) { int64_t vsize, resident; XMappingIter(vsize, resident); @@ -275,10 +267,9 @@ ResidentDistinguishedAmount(int64_t* aN) return NS_OK; } -static nsresult -ResidentFastDistinguishedAmount(int64_t* aN) +static nsresult GetResidentFast(int64_t* aN) { - return ResidentDistinguishedAmount(aN); + return GetResident(aN); } #elif defined(XP_MACOSX) @@ -298,8 +289,7 @@ static bool GetTaskBasicInfo(struct task_basic_info* aTi) // absurdly high, eg. 2GB+ even at start-up. But both 'top' and 'ps' report // it, so we might as well too. #define HAVE_VSIZE_AND_RESIDENT_REPORTERS 1 -static nsresult -VsizeDistinguishedAmount(int64_t* aN) +static nsresult GetVsize(int64_t* aN) { task_basic_info ti; if (!GetTaskBasicInfo(&ti)) @@ -316,7 +306,7 @@ VsizeDistinguishedAmount(int64_t* aN) // // Purging these pages can take a long time for some users (see bug 789975), // so we provide the option to get the RSS without purging first. -static nsresult ResidentDistinguishedAmountHelper(int64_t* aN, bool aDoPurge) +static nsresult GetResident(int64_t* aN, bool aDoPurge) { #ifdef HAVE_JEMALLOC_STATS if (aDoPurge) { @@ -333,16 +323,14 @@ static nsresult ResidentDistinguishedAmountHelper(int64_t* aN, bool aDoPurge) return NS_OK; } -static nsresult -ResidentFastDistinguishedAmount(int64_t* aN) +static nsresult GetResidentFast(int64_t* aN) { - return ResidentDistinguishedAmountHelper(aN, /* doPurge = */ false); + return GetResident(aN, /* doPurge = */ false); } -static nsresult -ResidentDistinguishedAmount(int64_t* aN) +static nsresult GetResident(int64_t* aN) { - return ResidentDistinguishedAmountHelper(aN, /* doPurge = */ true); + return GetResident(aN, /* doPurge = */ true); } #elif defined(XP_WIN) @@ -352,8 +340,7 @@ ResidentDistinguishedAmount(int64_t* aN) #include #define HAVE_VSIZE_AND_RESIDENT_REPORTERS 1 -static nsresult -VsizeDistinguishedAmount(int64_t* aN) +static nsresult GetVsize(int64_t* aN) { MEMORYSTATUSEX s; s.dwLength = sizeof(s); @@ -366,8 +353,7 @@ VsizeDistinguishedAmount(int64_t* aN) return NS_OK; } -static nsresult -ResidentDistinguishedAmount(int64_t* aN) +static nsresult GetResident(int64_t* aN) { PROCESS_MEMORY_COUNTERS pmc; pmc.cb = sizeof(PROCESS_MEMORY_COUNTERS); @@ -380,15 +366,13 @@ ResidentDistinguishedAmount(int64_t* aN) return NS_OK; } -static nsresult -ResidentFastDistinguishedAmount(int64_t* aN) +static nsresult GetResidentFast(int64_t* aN) { - return ResidentDistinguishedAmount(aN); + return GetResident(aN); } #define HAVE_VSIZE_MAX_CONTIGUOUS_REPORTER 1 -static nsresult -VsizeMaxContiguousDistinguishedAmount(int64_t* aN) +static nsresult GetVsizeMaxContiguous(int64_t* aN) { SIZE_T biggestRegion = 0; MEMORY_BASIC_INFORMATION vmemInfo = {0}; @@ -425,7 +409,7 @@ public: NS_IMETHOD GetAmount(int64_t* aAmount) { - return VsizeMaxContiguousDistinguishedAmount(aAmount); + return GetVsizeMaxContiguous(aAmount); } }; @@ -473,10 +457,7 @@ public: "resources used by the process.") {} - NS_IMETHOD GetAmount(int64_t* aAmount) - { - return VsizeDistinguishedAmount(aAmount); - } + NS_IMETHOD GetAmount(int64_t* aAmount) { return GetVsize(aAmount); } }; class ResidentReporter MOZ_FINAL : public MemoryUniReporter @@ -492,10 +473,7 @@ public: "time.") {} - NS_IMETHOD GetAmount(int64_t* aAmount) - { - return ResidentDistinguishedAmount(aAmount); - } + NS_IMETHOD GetAmount(int64_t* aAmount) { return GetResident(aAmount); } }; #endif // HAVE_VSIZE_AND_RESIDENT_REPORTERS @@ -1318,7 +1296,7 @@ NS_IMETHODIMP nsMemoryReporterManager::GetVsize(int64_t* aVsize) { #ifdef HAVE_VSIZE_AND_RESIDENT_REPORTERS - return VsizeDistinguishedAmount(aVsize); + return ::GetVsize(aVsize); #else *aResident = 0; return NS_ERROR_NOT_AVAILABLE; @@ -1329,7 +1307,7 @@ NS_IMETHODIMP nsMemoryReporterManager::GetVsizeMaxContiguous(int64_t* aAmount) { #ifdef HAVE_VSIZE_MAX_CONTIGUOUS_REPORTER - return VsizeMaxContiguousDistinguishedAmount(aAmount); + return ::GetVsizeMaxContiguous(aAmount); #else *aAmount = 0; return NS_ERROR_NOT_AVAILABLE; @@ -1340,7 +1318,7 @@ NS_IMETHODIMP nsMemoryReporterManager::GetResident(int64_t* aAmount) { #ifdef HAVE_VSIZE_AND_RESIDENT_REPORTERS - return ResidentDistinguishedAmount(aAmount); + return ::GetResident(aAmount); #else *aAmount = 0; return NS_ERROR_NOT_AVAILABLE; @@ -1351,7 +1329,7 @@ NS_IMETHODIMP nsMemoryReporterManager::GetResidentFast(int64_t* aAmount) { #ifdef HAVE_VSIZE_AND_RESIDENT_REPORTERS - return ResidentFastDistinguishedAmount(aAmount); + return ::GetResidentFast(aAmount); #else *aAmount = 0; return NS_ERROR_NOT_AVAILABLE;