Bug 668137 - Add vsize to about:memory on Windows. r=njn

This commit is contained in:
Justin Lebar 2011-06-30 00:10:50 -04:00
parent a4a8a220ac
commit 29c3d90d47

View File

@ -132,6 +132,18 @@ static PRInt64 GetResident()
#include <windows.h> #include <windows.h>
#include <psapi.h> #include <psapi.h>
static PRInt64 GetVsize()
{
MEMORYSTATUSEX s;
s.dwLength = sizeof(s);
bool success = GlobalMemoryStatusEx(&s);
if (!success)
return -1;
return s.ullTotalPhys - s.ullAvailPhys;
}
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
static PRInt64 GetPrivate() static PRInt64 GetPrivate()
{ {
@ -175,7 +187,7 @@ static PRInt64 GetResident()
#endif #endif
#if defined(XP_LINUX) || defined(XP_MACOSX) #if defined(XP_LINUX) || defined(XP_MACOS) || defined(XP_WIN)
NS_MEMORY_REPORTER_IMPLEMENT(Vsize, NS_MEMORY_REPORTER_IMPLEMENT(Vsize,
"vsize", "vsize",
KIND_OTHER, KIND_OTHER,
@ -189,7 +201,9 @@ NS_MEMORY_REPORTER_IMPLEMENT(Vsize,
"This is the vsize figure as reported by 'top' or 'ps'; on Mac the amount " "This is the vsize figure as reported by 'top' or 'ps'; on Mac the amount "
"of memory shared with other processes is very high and so this figure is " "of memory shared with other processes is very high and so this figure is "
"of limited use.") "of limited use.")
#endif
#if defined(XP_LINUX) || defined(XP_MACOSX)
NS_MEMORY_REPORTER_IMPLEMENT(SoftPageFaults, NS_MEMORY_REPORTER_IMPLEMENT(SoftPageFaults,
"soft-page-faults", "soft-page-faults",
KIND_OTHER, KIND_OTHER,
@ -400,11 +414,16 @@ nsMemoryReporterManager::Init()
REGISTER(HeapUnused); REGISTER(HeapUnused);
REGISTER(Resident); REGISTER(Resident);
#if defined(XP_LINUX) || defined(XP_MACOSX) #if defined(XP_LINUX) || defined(XP_MACOSX) || defined(XP_WIN)
REGISTER(Vsize); REGISTER(Vsize);
#endif
#if defined(XP_LINUX) || defined(XP_MACOSX)
REGISTER(SoftPageFaults); REGISTER(SoftPageFaults);
REGISTER(HardPageFaults); REGISTER(HardPageFaults);
#elif defined(XP_WIN) && MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN #endif
#if defined(XP_WIN) && MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
REGISTER(Private); REGISTER(Private);
#endif #endif