Bug 802007 - Remove unneeded Mac-only memory reporters. r=jlebar.

This commit is contained in:
Nicholas Nethercote 2012-10-15 21:45:54 -07:00
parent b9acc431b5
commit c8cb13bace

View File

@ -419,8 +419,6 @@ NS_FALLIBLE_MEMORY_REPORTER_IMPLEMENT(PageFaultsHard,
#if HAVE_JEMALLOC_STATS
#define HAVE_HEAP_ALLOCATED_REPORTERS 1
static int64_t GetHeapUnused()
{
jemalloc_stats_t stats;
@ -505,62 +503,6 @@ NS_MEMORY_REPORTER_IMPLEMENT(HeapDirty,
"doesn't have to ask the OS the next time it needs to fulfill a request. "
"This value is typically not larger than a few megabytes.")
#elif defined(XP_MACOSX) && !defined(MOZ_MEMORY)
#include <malloc/malloc.h>
#define HAVE_HEAP_ALLOCATED_REPORTERS 1
static int64_t GetHeapUnused()
{
struct mstats stats = mstats();
return stats.bytes_total - stats.bytes_used;
}
static int64_t GetHeapAllocated()
{
struct mstats stats = mstats();
return stats.bytes_used;
}
// malloc_zone_statistics() crashes when run under DMDV because Valgrind
// doesn't intercept it. This measurement isn't important for DMDV, so don't
// even try to get it.
#ifndef MOZ_DMDV
#define HAVE_HEAP_ZONE0_REPORTERS 1
static int64_t GetHeapZone0Committed()
{
malloc_statistics_t stats;
malloc_zone_statistics(malloc_default_zone(), &stats);
return stats.size_in_use;
}
static int64_t GetHeapZone0Used()
{
malloc_statistics_t stats;
malloc_zone_statistics(malloc_default_zone(), &stats);
return stats.size_allocated;
}
NS_MEMORY_REPORTER_IMPLEMENT(HeapZone0Committed,
"heap-zone0-committed",
KIND_OTHER,
UNITS_BYTES,
GetHeapZone0Committed,
"Memory mapped by the heap allocator that is committed in the default "
"zone.")
NS_MEMORY_REPORTER_IMPLEMENT(HeapZone0Used,
"heap-zone0-used",
KIND_OTHER,
UNITS_BYTES,
GetHeapZone0Used,
"Memory mapped by the heap allocator in the default zone that is "
"allocated to the application.")
#endif // MOZ_DMDV
#endif
#ifdef HAVE_HEAP_ALLOCATED_REPORTERS
NS_MEMORY_REPORTER_IMPLEMENT(HeapUnused,
"heap-unused",
KIND_OTHER,
@ -581,8 +523,7 @@ NS_MEMORY_REPORTER_IMPLEMENT(HeapAllocated,
"exact amount requested is not recorded.)")
// The computation of "explicit" fails if "heap-allocated" isn't available,
// which is why this is depends on HAVE_HEAP_ALLOCATED_AND_EXPLICIT_REPORTERS.
#define HAVE_EXPLICIT_REPORTER 1
// which is why this is depends on HAVE_JEMALLOC_STATS.
static nsresult GetExplicit(int64_t *n)
{
nsCOMPtr<nsIMemoryReporterManager> mgr = do_GetService("@mozilla.org/memory-reporter-manager;1");
@ -600,7 +541,7 @@ NS_FALLIBLE_MEMORY_REPORTER_IMPLEMENT(Explicit,
"This is the same measurement as the root of the 'explicit' tree. "
"However, it is measured at a different time and so gives slightly "
"different results.")
#endif // HAVE_HEAP_ALLOCATED_REPORTERS
#endif // HAVE_JEMALLOC_STATS
NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(AtomTableMallocSizeOf, "atom-table")
@ -636,12 +577,13 @@ nsMemoryReporterManager::Init()
#define REGISTER(_x) RegisterReporter(new NS_MEMORY_REPORTER_NAME(_x))
#ifdef HAVE_HEAP_ALLOCATED_REPORTERS
#ifdef HAVE_JEMALLOC_STATS
REGISTER(HeapAllocated);
REGISTER(HeapUnused);
#endif
#ifdef HAVE_EXPLICIT_REPORTER
REGISTER(HeapCommitted);
REGISTER(HeapCommittedUnused);
REGISTER(HeapCommittedUnusedRatio);
REGISTER(HeapDirty);
REGISTER(Explicit);
#endif
@ -659,15 +601,6 @@ nsMemoryReporterManager::Init()
REGISTER(Private);
#endif
#if defined(HAVE_JEMALLOC_STATS)
REGISTER(HeapCommitted);
REGISTER(HeapCommittedUnused);
REGISTER(HeapCommittedUnusedRatio);
REGISTER(HeapDirty);
#elif defined(HAVE_HEAP_ZONE0_REPORTERS)
REGISTER(HeapZone0Committed);
REGISTER(HeapZone0Used);
#endif
REGISTER(AtomTable);
@ -820,7 +753,7 @@ nsMemoryReporterManager::GetExplicit(int64_t *aExplicit)
{
NS_ENSURE_ARG_POINTER(aExplicit);
*aExplicit = 0;
#ifndef HAVE_EXPLICIT_REPORTER
#ifndef HAVE_JEMALLOC_STATS
return NS_ERROR_NOT_AVAILABLE;
#else
nsresult rv;
@ -913,7 +846,7 @@ nsMemoryReporterManager::GetExplicit(int64_t *aExplicit)
*aExplicit = heapAllocated + explicitNonHeapNormalSize + explicitNonHeapMultiSize;
return NS_OK;
#endif // HAVE_HEAP_ALLOCATED_AND_EXPLICIT_REPORTERS
#endif // HAVE_JEMALLOC_STATS
}
NS_IMETHODIMP