Bug 939385 (part 4, attempt 2) - Rename some distinguished amount functions. r=froydnj.

--HG--
extra : rebase_source : fc5a8b80752156cf8d13908eb2f961d75a954126
This commit is contained in:
Nicholas Nethercote 2013-11-18 22:37:39 -08:00
parent 43a4ea8706
commit d7ef1243fd

View File

@ -59,19 +59,22 @@ static nsresult GetProcSelfStatmField(int aField, int64_t* aN)
}
#define HAVE_VSIZE_AND_RESIDENT_REPORTERS 1
static nsresult GetVsize(int64_t* aN)
static nsresult
VsizeDistinguishedAmount(int64_t* aN)
{
return GetProcSelfStatmField(0, aN);
}
static nsresult GetResident(int64_t* aN)
static nsresult
ResidentDistinguishedAmount(int64_t* aN)
{
return GetProcSelfStatmField(1, aN);
}
static nsresult GetResidentFast(int64_t* aN)
static nsresult
ResidentFastDistinguishedAmount(int64_t* aN)
{
return GetResident(aN);
return ResidentDistinguishedAmount(aN);
}
#define HAVE_RESIDENT_UNIQUE_REPORTER
@ -173,7 +176,8 @@ static nsresult GetKinfoProcSelf(KINFO_PROC* aProc)
}
#define HAVE_VSIZE_AND_RESIDENT_REPORTERS 1
static nsresult GetVsize(int64_t* aN)
static nsresult
VsizeDistinguishedAmount(int64_t* aN)
{
KINFO_PROC proc;
nsresult rv = GetKinfoProcSelf(&proc);
@ -183,7 +187,8 @@ static nsresult GetVsize(int64_t* aN)
return rv;
}
static nsresult GetResident(int64_t* aN)
static nsresult
ResidentDistinguishedAmount(int64_t* aN)
{
KINFO_PROC proc;
nsresult rv = GetKinfoProcSelf(&proc);
@ -193,9 +198,10 @@ static nsresult GetResident(int64_t* aN)
return rv;
}
static nsresult GetResidentFast(int64_t* aN)
static nsresult
ResidentFastDistinguishedAmount(int64_t* aN)
{
return GetResident(aN);
return ResidentDistinguishedAmount(aN);
}
#elif defined(SOLARIS)
@ -246,7 +252,8 @@ static void XMappingIter(int64_t& vsize, int64_t& resident)
}
#define HAVE_VSIZE_AND_RESIDENT_REPORTERS 1
static nsresult GetVsize(int64_t* aN)
static nsresult
VsizeDistinguishedAmount(int64_t* aN)
{
int64_t vsize, resident;
XMappingIter(vsize, resident);
@ -257,7 +264,8 @@ static nsresult GetVsize(int64_t* aN)
return NS_OK;
}
static nsresult GetResident(int64_t* aN)
static nsresult
ResidentDistinguishedAmount(int64_t* aN)
{
int64_t vsize, resident;
XMappingIter(vsize, resident);
@ -268,9 +276,10 @@ static nsresult GetResident(int64_t* aN)
return NS_OK;
}
static nsresult GetResidentFast(int64_t* aN)
static nsresult
ResidentFastDistinguishedAmount(int64_t* aN)
{
return GetResident(aN);
return ResidentDistinguishedAmount(aN);
}
#elif defined(XP_MACOSX)
@ -290,7 +299,8 @@ 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 GetVsize(int64_t* aN)
static nsresult
VsizeDistinguishedAmount(int64_t* aN)
{
task_basic_info ti;
if (!GetTaskBasicInfo(&ti))
@ -307,7 +317,7 @@ static nsresult GetVsize(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 GetResident(int64_t* aN, bool aDoPurge)
static nsresult ResidentDistinguishedAmountHelper(int64_t* aN, bool aDoPurge)
{
#ifdef HAVE_JEMALLOC_STATS
if (aDoPurge) {
@ -324,14 +334,16 @@ static nsresult GetResident(int64_t* aN, bool aDoPurge)
return NS_OK;
}
static nsresult GetResidentFast(int64_t* aN)
static nsresult
ResidentFastDistinguishedAmount(int64_t* aN)
{
return GetResident(aN, /* doPurge = */ false);
return ResidentDistinguishedAmountHelper(aN, /* doPurge = */ false);
}
static nsresult GetResident(int64_t* aN)
static nsresult
ResidentDistinguishedAmount(int64_t* aN)
{
return GetResident(aN, /* doPurge = */ true);
return ResidentDistinguishedAmountHelper(aN, /* doPurge = */ true);
}
#elif defined(XP_WIN)
@ -341,7 +353,8 @@ static nsresult GetResident(int64_t* aN)
#include <algorithm>
#define HAVE_VSIZE_AND_RESIDENT_REPORTERS 1
static nsresult GetVsize(int64_t* aN)
static nsresult
VsizeDistinguishedAmount(int64_t* aN)
{
MEMORYSTATUSEX s;
s.dwLength = sizeof(s);
@ -354,7 +367,8 @@ static nsresult GetVsize(int64_t* aN)
return NS_OK;
}
static nsresult GetResident(int64_t* aN)
static nsresult
ResidentDistinguishedAmount(int64_t* aN)
{
PROCESS_MEMORY_COUNTERS pmc;
pmc.cb = sizeof(PROCESS_MEMORY_COUNTERS);
@ -367,13 +381,15 @@ static nsresult GetResident(int64_t* aN)
return NS_OK;
}
static nsresult GetResidentFast(int64_t* aN)
static nsresult
ResidentFastDistinguishedAmount(int64_t* aN)
{
return GetResident(aN);
return ResidentDistinguishedAmount(aN);
}
#define HAVE_VSIZE_MAX_CONTIGUOUS_REPORTER 1
static nsresult GetVsizeMaxContiguous(int64_t* aN)
static nsresult
VsizeMaxContiguousDistinguishedAmount(int64_t* aN)
{
SIZE_T biggestRegion = 0;
MEMORY_BASIC_INFORMATION vmemInfo = {0};
@ -410,7 +426,7 @@ public:
NS_IMETHOD GetAmount(int64_t* aAmount)
{
return GetVsizeMaxContiguous(aAmount);
return VsizeMaxContiguousDistinguishedAmount(aAmount);
}
};
@ -458,7 +474,10 @@ public:
"resources used by the process.")
{}
NS_IMETHOD GetAmount(int64_t* aAmount) { return GetVsize(aAmount); }
NS_IMETHOD GetAmount(int64_t* aAmount)
{
return VsizeDistinguishedAmount(aAmount);
}
};
class ResidentReporter MOZ_FINAL : public MemoryUniReporter
@ -474,7 +493,10 @@ public:
"time.")
{}
NS_IMETHOD GetAmount(int64_t* aAmount) { return GetResident(aAmount); }
NS_IMETHOD GetAmount(int64_t* aAmount)
{
return ResidentDistinguishedAmount(aAmount);
}
};
#endif // HAVE_VSIZE_AND_RESIDENT_REPORTERS
@ -1299,7 +1321,7 @@ NS_IMETHODIMP
nsMemoryReporterManager::GetVsize(int64_t* aVsize)
{
#ifdef HAVE_VSIZE_AND_RESIDENT_REPORTERS
return ::GetVsize(aVsize);
return VsizeDistinguishedAmount(aVsize);
#else
*aResident = 0;
return NS_ERROR_NOT_AVAILABLE;
@ -1310,7 +1332,7 @@ NS_IMETHODIMP
nsMemoryReporterManager::GetVsizeMaxContiguous(int64_t* aAmount)
{
#ifdef HAVE_VSIZE_MAX_CONTIGUOUS_REPORTER
return ::GetVsizeMaxContiguous(aAmount);
return VsizeMaxContiguousDistinguishedAmount(aAmount);
#else
*aAmount = 0;
return NS_ERROR_NOT_AVAILABLE;
@ -1321,7 +1343,7 @@ NS_IMETHODIMP
nsMemoryReporterManager::GetResident(int64_t* aAmount)
{
#ifdef HAVE_VSIZE_AND_RESIDENT_REPORTERS
return ::GetResident(aAmount);
return ResidentDistinguishedAmount(aAmount);
#else
*aAmount = 0;
return NS_ERROR_NOT_AVAILABLE;
@ -1332,7 +1354,7 @@ NS_IMETHODIMP
nsMemoryReporterManager::GetResidentFast(int64_t* aAmount)
{
#ifdef HAVE_VSIZE_AND_RESIDENT_REPORTERS
return ::GetResidentFast(aAmount);
return ResidentFastDistinguishedAmount(aAmount);
#else
*aAmount = 0;
return NS_ERROR_NOT_AVAILABLE;