mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
b=566467; add win32 core memory reporters; r=jmathies
This commit is contained in:
parent
6709a65d60
commit
dea7fa4278
@ -156,6 +156,49 @@ NS_MEMORY_REPORTER_IMPLEMENT(MallocDefaultAllocated,
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(XP_WIN) && !defined(WINCE)
|
||||||
|
#include <windows.h>
|
||||||
|
#include <psapi.h>
|
||||||
|
|
||||||
|
static PRInt64 GetWin32PrivateBytes(void *) {
|
||||||
|
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
|
||||||
|
PROCESS_MEMORY_COUNTERS_EX pmcex;
|
||||||
|
pmcex.cb = sizeof(PROCESS_MEMORY_COUNTERS_EX);
|
||||||
|
|
||||||
|
if (!GetProcessMemoryInfo(GetCurrentProcess(),
|
||||||
|
(PPROCESS_MEMORY_COUNTERS) &pmcex,
|
||||||
|
sizeof(PROCESS_MEMORY_COUNTERS_EX)))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return pmcex.PrivateUsage;
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static PRInt64 GetWin32WorkingSetSize(void *) {
|
||||||
|
PROCESS_MEMORY_COUNTERS pmc;
|
||||||
|
pmc.cb = sizeof(PROCESS_MEMORY_COUNTERS);
|
||||||
|
|
||||||
|
if (!GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc)))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return pmc.WorkingSetSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_MEMORY_REPORTER_IMPLEMENT(Win32WorkingSetSize,
|
||||||
|
"win32/workingset",
|
||||||
|
"Win32 working set size",
|
||||||
|
GetWin32WorkingSetSize,
|
||||||
|
nsnull);
|
||||||
|
|
||||||
|
NS_MEMORY_REPORTER_IMPLEMENT(Win32PrivateBytes,
|
||||||
|
"win32/privatebytes",
|
||||||
|
"Win32 private bytes (cannot be shared with other processes). (Available only on Windows XP SP2 or later.)",
|
||||||
|
GetWin32PrivateBytes,
|
||||||
|
nsnull);
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** nsMemoryReporterManager implementation
|
** nsMemoryReporterManager implementation
|
||||||
**/
|
**/
|
||||||
@ -165,33 +208,34 @@ NS_IMPL_ISUPPORTS1(nsMemoryReporterManager, nsIMemoryReporterManager)
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsMemoryReporterManager::Init()
|
nsMemoryReporterManager::Init()
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIMemoryReporter> mr;
|
/*
|
||||||
|
* Register our core reporters
|
||||||
|
*/
|
||||||
|
#define REGISTER(_x) RegisterReporter(new NS_MEMORY_REPORTER_NAME(_x))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Register our core jemalloc/malloc reporters
|
* Register our core jemalloc/malloc reporters
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_MALLOC_REPORTERS
|
#ifdef HAVE_MALLOC_REPORTERS
|
||||||
mr = new NS_MEMORY_REPORTER_NAME(MallocAllocated);
|
REGISTER(MallocAllocated);
|
||||||
RegisterReporter(mr);
|
REGISTER(MallocMapped);
|
||||||
|
|
||||||
mr = new NS_MEMORY_REPORTER_NAME(MallocMapped);
|
|
||||||
RegisterReporter(mr);
|
|
||||||
|
|
||||||
#if defined(HAVE_JEMALLOC_STATS)
|
#if defined(HAVE_JEMALLOC_STATS)
|
||||||
mr = new NS_MEMORY_REPORTER_NAME(MallocCommitted);
|
REGISTER(MallocCommitted);
|
||||||
RegisterReporter(mr);
|
REGISTER(MallocDirty);
|
||||||
|
|
||||||
mr = new NS_MEMORY_REPORTER_NAME(MallocDirty);
|
|
||||||
RegisterReporter(mr);
|
|
||||||
#elif defined(XP_MACOSX) && !defined(MOZ_MEMORY)
|
#elif defined(XP_MACOSX) && !defined(MOZ_MEMORY)
|
||||||
mr = new NS_MEMORY_REPORTER_NAME(MallocDefaultCommitted);
|
REGISTER(MallocDefaultCommitted);
|
||||||
RegisterReporter(mr);
|
REGISTER(MallocDefaultAllocated);
|
||||||
|
|
||||||
mr = new NS_MEMORY_REPORTER_NAME(MallocDefaultAllocated);
|
|
||||||
RegisterReporter(mr);
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(XP_WIN) && !defined(WINCE)
|
||||||
|
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
|
||||||
|
REGISTER(Win32PrivateBytes);
|
||||||
|
#endif
|
||||||
|
REGISTER(Win32WorkingSetSize);
|
||||||
|
#endif
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user