Bug 1413096 - Remove compile-time constants from data returned by jemalloc_stats. r?njn draft
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 31 Oct 2017 16:39:49 +0900
changeset 689179 d7f47d87788c21baf22c9c2460d54004103d7b0b
parent 689174 f32d044bfdf0a7f4b015e6692c10393ba66d2b3a
child 738258 1d22ca2953768f948cb66a6a5d5e70418b1d6b62
push id86955
push userbmo:mh+mozilla@glandium.org
push dateTue, 31 Oct 2017 07:40:35 +0000
reviewersnjn
bugs1413096
milestone58.0a1
Bug 1413096 - Remove compile-time constants from data returned by jemalloc_stats. r?njn
memory/build/mozjemalloc.cpp
memory/build/mozjemalloc_types.h
xpcom/base/nsMemoryReporterManager.cpp
--- a/memory/build/mozjemalloc.cpp
+++ b/memory/build/mozjemalloc.cpp
@@ -4580,20 +4580,17 @@ MozJemalloc::jemalloc_stats(jemalloc_sta
   if (!malloc_initialized) {
     memset(aStats, 0, sizeof(*aStats));
     return;
   }
 
   // Gather runtime settings.
   aStats->opt_junk = opt_junk;
   aStats->opt_zero = opt_zero;
-  aStats->quantum = quantum;
-  aStats->small_max = small_max;
   aStats->large_max = arena_maxclass;
-  aStats->chunksize = chunksize;
   aStats->page_size = pagesize;
   aStats->dirty_max = opt_dirty_max;
 
   // Gather current memory usage statistics.
   aStats->narenas = 0;
   aStats->mapped = 0;
   aStats->allocated = 0;
   aStats->waste = 0;
@@ -4673,17 +4670,17 @@ MozJemalloc::jemalloc_stats(jemalloc_sta
     aStats->bin_unused += arena_unused;
     aStats->bookkeeping += arena_headers;
     aStats->narenas++;
   }
   arena_t::sCollection.mLock.Unlock();
 
   // Account for arena chunk headers in bookkeeping rather than waste.
   chunk_header_size =
-    ((aStats->mapped / aStats->chunksize) * arena_chunk_header_npages)
+    ((aStats->mapped / chunksize) * arena_chunk_header_npages)
     << pagesize_2pow;
 
   aStats->mapped += non_arena_mapped;
   aStats->bookkeeping += chunk_header_size;
   aStats->waste -= chunk_header_size;
 
   MOZ_ASSERT(aStats->mapped >= aStats->allocated + aStats->waste +
                                  aStats->page_cache + aStats->bookkeeping);
--- a/memory/build/mozjemalloc_types.h
+++ b/memory/build/mozjemalloc_types.h
@@ -59,20 +59,17 @@ typedef size_t arena_id_t;
  */
 typedef struct {
 	/*
 	 * Run-time configuration settings.
 	 */
 	bool	opt_junk;	/* Fill allocated memory with kAllocJunk? */
 	bool	opt_zero;	/* Fill allocated memory with 0x0? */
 	size_t	narenas;	/* Number of arenas. */
-	size_t	quantum;	/* Allocation quantum. */
-	size_t	small_max;	/* Max quantum-spaced allocation size. */
 	size_t	large_max;	/* Max sub-chunksize allocation size. */
-	size_t	chunksize;	/* Size of each virtual memory mapping. */
 	size_t  page_size;	/* Size of pages. */
 	size_t	dirty_max;	/* Max dirty pages per arena. */
 
 	/*
 	 * Current memory usage statistics.
 	 */
 	size_t	mapped;		/* Bytes mapped (not necessarily committed). */
 	size_t	allocated;	/* Bytes allocated (committed, in use by application). */
--- a/xpcom/base/nsMemoryReporterManager.cpp
+++ b/xpcom/base/nsMemoryReporterManager.cpp
@@ -1354,20 +1354,16 @@ public:
       HeapOverhead(&stats),
 "The sum of 'explicit/heap-overhead/*'.");
 
     MOZ_COLLECT_REPORT(
       "heap-mapped", KIND_OTHER, UNITS_BYTES, stats.mapped,
 "Amount of memory currently mapped. Includes memory that is uncommitted, i.e. "
 "neither in physical memory nor paged to disk.");
 
-    MOZ_COLLECT_REPORT(
-      "heap-chunksize", KIND_OTHER, UNITS_BYTES, stats.chunksize,
-      "Size of chunks.");
-
     return NS_OK;
   }
 };
 NS_IMPL_ISUPPORTS(JemallocHeapReporter, nsIMemoryReporter)
 
 #endif  // HAVE_JEMALLOC_STATS
 
 // Why is this here?  At first glance, you'd think it could be defined and