Bug 1511141 - Disable formatting for more MOZ_COLLECT_REPORT calls. r=erahm
authorAndrew McCreight <continuation@gmail.com>
Thu, 29 Nov 2018 21:41:48 +0000
changeset 448859 2f64401a8c87071cb2f5943f02b8a62f89111c09
parent 448858 840ea0c4fbfedb6d965326354c0793895a678b03
child 448860 da4984e0016a1beac3845f64ce329b67dfa81baa
push id35129
push usernerli@mozilla.com
push dateFri, 30 Nov 2018 09:34:14 +0000
treeherdermozilla-central@c5b713000513 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerserahm
bugs1511141
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1511141 - Disable formatting for more MOZ_COLLECT_REPORT calls. r=erahm Differential Revision: https://phabricator.services.mozilla.com/D13463
dom/base/nsWindowMemoryReporter.cpp
image/SurfaceCache.cpp
xpcom/base/nsMemoryReporterManager.cpp
--- a/dom/base/nsWindowMemoryReporter.cpp
+++ b/dom/base/nsWindowMemoryReporter.cpp
@@ -556,26 +556,28 @@ nsWindowMemoryReporter::CollectReports(n
       path,
       nsIMemoryReporter::KIND_OTHER,
       nsIMemoryReporter::UNITS_COUNT,
       /* amount = */ 1,
       /* description = */ NS_LITERAL_CSTRING("A ghost window."),
       aData);
   }
 
+  // clang-format off
   MOZ_COLLECT_REPORT(
     "ghost-windows", KIND_OTHER, UNITS_COUNT, ghostWindows.Count(),
 "The number of ghost windows present (the number of nodes underneath "
 "explicit/window-objects/top(none)/ghost, modulo race conditions).  A ghost "
 "window is not shown in any tab, is not in a tab group with any "
 "non-detached windows, and has met these criteria for at least "
 "memory.ghost_window_timeout_seconds, or has survived a round of "
 "about:memory's minimize memory usage button.\n\n"
 "Ghost windows can happen legitimately, but they are often indicative of "
 "leaks in the browser or add-ons.");
+  // clang-format on
 
   WindowPaths windowPaths;
   WindowPaths topWindowPaths;
 
   // Collect window memory usage.
   SizeOfState fakeState(nullptr);   // this won't be used
   nsWindowSizes windowTotalSizes(fakeState);
   for (uint32_t i = 0; i < windows.Length(); i++) {
--- a/image/SurfaceCache.cpp
+++ b/image/SurfaceCache.cpp
@@ -1223,16 +1223,17 @@ public:
 
   NS_IMETHOD
   CollectReports(nsIHandleReportCallback* aHandleReport,
                  nsISupports*             aData,
                  bool                     aAnonymize) override
   {
     StaticMutexAutoLock lock(sInstanceMutex);
 
+    // clang-format off
     // We have explicit memory reporting for the surface cache which is more
     // accurate than the cost metrics we report here, but these metrics are
     // still useful to report, since they control the cache's behavior.
     MOZ_COLLECT_REPORT(
       "imagelib-surface-cache-estimated-total",
       KIND_OTHER, UNITS_BYTES, (mMaxCost - mAvailableCost),
 "Estimated total memory used by the imagelib surface cache.");
 
@@ -1241,16 +1242,17 @@ public:
       KIND_OTHER, UNITS_BYTES, mLockedCost,
 "Estimated memory used by locked surfaces in the imagelib surface cache.");
 
     MOZ_COLLECT_REPORT(
       "imagelib-surface-cache-overflow-count",
       KIND_OTHER, UNITS_COUNT, mOverflowCount,
 "Count of how many times the surface cache has hit its capacity and been "
 "unable to insert a new surface.");
+    // clang-format on
 
     return NS_OK;
   }
 
   void CollectSizeOfSurfaces(const ImageKey                  aImageKey,
                              nsTArray<SurfaceMemoryCounter>& aCounters,
                              MallocSizeOf                    aMallocSizeOf,
                              const StaticMutexAutoLock&      aAutoLock)
--- a/xpcom/base/nsMemoryReporterManager.cpp
+++ b/xpcom/base/nsMemoryReporterManager.cpp
@@ -1019,21 +1019,23 @@ class PrivateReporter final : public nsI
 public:
   NS_DECL_ISUPPORTS
 
   NS_IMETHOD CollectReports(nsIHandleReportCallback* aHandleReport,
                             nsISupports* aData, bool aAnonymize) override
   {
     int64_t amount;
     if (NS_SUCCEEDED(PrivateDistinguishedAmount(&amount))) {
+      // clang-format off
       MOZ_COLLECT_REPORT(
         "private", KIND_OTHER, UNITS_BYTES, amount,
 "Memory that cannot be shared with other processes, including memory that is "
 "committed and marked MEM_PRIVATE, data that is not mapped, and executable "
 "pages that have been written to.");
+      // clang-format on
     }
     return NS_OK;
   }
 };
 NS_IMPL_ISUPPORTS(PrivateReporter, nsIMemoryReporter)
 #endif
 
 #ifdef HAVE_VSIZE_AND_RESIDENT_REPORTERS
@@ -1044,25 +1046,27 @@ class VsizeReporter final : public nsIMe
 public:
   NS_DECL_ISUPPORTS
 
   NS_IMETHOD CollectReports(nsIHandleReportCallback* aHandleReport,
                             nsISupports* aData, bool aAnonymize) override
   {
     int64_t amount;
     if (NS_SUCCEEDED(VsizeDistinguishedAmount(&amount))) {
+      // clang-format off
       MOZ_COLLECT_REPORT(
         "vsize", KIND_OTHER, UNITS_BYTES, amount,
 "Memory mapped by the process, including code and data segments, the heap, "
 "thread stacks, memory explicitly mapped by the process via mmap and similar "
 "operations, and memory shared with other processes. This is the vsize figure "
 "as reported by 'top' and 'ps'.  This figure is of limited use on Mac, where "
 "processes share huge amounts of memory with one another.  But even on other "
 "operating systems, 'resident' is a much better measure of the memory "
 "resources used by the process.");
+      // clang-format on
     }
     return NS_OK;
   }
 };
 NS_IMPL_ISUPPORTS(VsizeReporter, nsIMemoryReporter)
 
 class ResidentReporter final : public nsIMemoryReporter
 {
@@ -1071,24 +1075,26 @@ class ResidentReporter final : public ns
 public:
   NS_DECL_ISUPPORTS
 
   NS_IMETHOD CollectReports(nsIHandleReportCallback* aHandleReport,
                             nsISupports* aData, bool aAnonymize) override
   {
     int64_t amount;
     if (NS_SUCCEEDED(ResidentDistinguishedAmount(&amount))) {
+      // clang-format off
       MOZ_COLLECT_REPORT(
         "resident", KIND_OTHER, UNITS_BYTES, amount,
 "Memory mapped by the process that is present in physical memory, also known "
 "as the resident set size (RSS).  This is the best single figure to use when "
 "considering the memory resources used by the process, but it depends both on "
 "other processes being run and details of the OS kernel and so is best used "
 "for comparing the memory usage of a single process at different points in "
 "time.");
+      // clang-format on
     }
     return NS_OK;
   }
 };
 NS_IMPL_ISUPPORTS(ResidentReporter, nsIMemoryReporter)
 
 #endif  // HAVE_VSIZE_AND_RESIDENT_REPORTERS
 
@@ -1100,22 +1106,24 @@ class ResidentUniqueReporter final : pub
 public:
   NS_DECL_ISUPPORTS
 
   NS_IMETHOD CollectReports(nsIHandleReportCallback* aHandleReport,
                             nsISupports* aData, bool aAnonymize) override
   {
     int64_t amount = 0;
     if (NS_SUCCEEDED(ResidentUniqueDistinguishedAmount(&amount))) {
+      // clang-format off
       MOZ_COLLECT_REPORT(
         "resident-unique", KIND_OTHER, UNITS_BYTES, amount,
 "Memory mapped by the process that is present in physical memory and not "
 "shared with any other processes.  This is also known as the process's unique "
 "set size (USS).  This is the amount of RAM we'd expect to be freed if we "
 "closed this process.");
+      // clang-format on
     }
     return NS_OK;
   }
 };
 NS_IMPL_ISUPPORTS(ResidentUniqueReporter, nsIMemoryReporter)
 
 #endif // HAVE_RESIDENT_UNIQUE_REPORTER
 
@@ -1128,22 +1136,24 @@ class SystemHeapReporter final : public 
 public:
   NS_DECL_ISUPPORTS
 
   NS_IMETHOD CollectReports(nsIHandleReportCallback* aHandleReport,
                             nsISupports* aData, bool aAnonymize) override
   {
     int64_t amount;
     if (NS_SUCCEEDED(SystemHeapSize(&amount))) {
+      // clang-format off
       MOZ_COLLECT_REPORT(
         "system-heap-allocated", KIND_OTHER, UNITS_BYTES, amount,
 "Memory used by the system allocator that is currently allocated to the "
 "application. This is distinct from the jemalloc heap that Firefox uses for "
 "most or all of its heap allocations. Ideally this number is zero, but "
 "on some platforms we cannot force every heap allocation through jemalloc.");
+      // clang-format on
     }
     return NS_OK;
   }
 };
 NS_IMPL_ISUPPORTS(SystemHeapReporter, nsIMemoryReporter)
 
 #endif // HAVE_SYSTEM_HEAP_REPORTER
 
@@ -1209,27 +1219,29 @@ public:
 
   NS_IMETHOD CollectReports(nsIHandleReportCallback* aHandleReport,
                             nsISupports* aData, bool aAnonymize) override
   {
     struct rusage usage;
     int err = getrusage(RUSAGE_SELF, &usage);
     if (err == 0) {
       int64_t amount = usage.ru_minflt;
+      // clang-format off
       MOZ_COLLECT_REPORT(
         "page-faults-soft", KIND_OTHER, UNITS_COUNT_CUMULATIVE, amount,
 "The number of soft page faults (also known as 'minor page faults') that "
 "have occurred since the process started.  A soft page fault occurs when the "
 "process tries to access a page which is present in physical memory but is "
 "not mapped into the process's address space.  For instance, a process might "
 "observe soft page faults when it loads a shared library which is already "
 "present in physical memory. A process may experience many thousands of soft "
 "page faults even when the machine has plenty of available physical memory, "
 "and because the OS services a soft page fault without accessing the disk, "
 "they impact performance much less than hard page faults.");
+      // clang-format on
     }
     return NS_OK;
   }
 };
 NS_IMPL_ISUPPORTS(PageFaultsSoftReporter, nsIMemoryReporter)
 
 static MOZ_MUST_USE nsresult
 PageFaultsHardDistinguishedAmount(int64_t* aAmount)
@@ -1250,28 +1262,30 @@ class PageFaultsHardReporter final : pub
 public:
   NS_DECL_ISUPPORTS
 
   NS_IMETHOD CollectReports(nsIHandleReportCallback* aHandleReport,
                             nsISupports* aData, bool aAnonymize) override
   {
     int64_t amount = 0;
     if (NS_SUCCEEDED(PageFaultsHardDistinguishedAmount(&amount))) {
+      // clang-format off
       MOZ_COLLECT_REPORT(
         "page-faults-hard", KIND_OTHER, UNITS_COUNT_CUMULATIVE, amount,
 "The number of hard page faults (also known as 'major page faults') that have "
 "occurred since the process started.  A hard page fault occurs when a process "
 "tries to access a page which is not present in physical memory. The "
 "operating system must access the disk in order to fulfill a hard page fault. "
 "When memory is plentiful, you should see very few hard page faults. But if "
 "the process tries to use more memory than your machine has available, you "
 "may see many thousands of hard page faults. Because accessing the disk is up "
 "to a million times slower than accessing RAM, the program may run very "
 "slowly when it is experiencing more than 100 or so hard page faults a "
 "second.");
+      // clang-format on
     }
     return NS_OK;
   }
 };
 NS_IMPL_ISUPPORTS(PageFaultsHardReporter, nsIMemoryReporter)
 
 #endif  // XP_UNIX
 
@@ -1308,16 +1322,17 @@ public:
   NS_DECL_ISUPPORTS
 
   NS_IMETHOD CollectReports(nsIHandleReportCallback* aHandleReport,
                             nsISupports* aData, bool aAnonymize) override
   {
     jemalloc_stats_t stats;
     jemalloc_stats(&stats);
 
+    // clang-format off
     MOZ_COLLECT_REPORT(
       "heap-committed/allocated", KIND_OTHER, UNITS_BYTES, stats.allocated,
 "Memory mapped by the heap allocator that is currently allocated to the "
 "application.  This may exceed the amount of memory requested by the "
 "application because the allocator regularly rounds up request sizes. (The "
 "exact amount requested is not recorded.)");
 
     MOZ_COLLECT_REPORT(
@@ -1364,16 +1379,18 @@ public:
       "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.");
 
+    // clang-format on
+
     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