Bug 1247405 - Track peak texture memory usage r=nical
authorJames Willcox <snorp@snorp.net>
Wed, 10 Feb 2016 15:03:32 -0600
changeset 324082 fe64e32bb4fbdb8d43e2855add7c970cc600d367
parent 324081 c1f50ba71bfe66fc1fd76cbfb5e8cf8bfa84a9b5
child 324083 d7584b9e016655aad9900c849ae2f58ec3dbcc26
push id1128
push userjlund@mozilla.com
push dateWed, 01 Jun 2016 01:31:59 +0000
treeherdermozilla-release@fe0d30de989d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical
bugs1247405
milestone47.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 1247405 - Track peak texture memory usage r=nical
gfx/gl/GfxTexturesReporter.cpp
gfx/gl/GfxTexturesReporter.h
--- a/gfx/gl/GfxTexturesReporter.cpp
+++ b/gfx/gl/GfxTexturesReporter.cpp
@@ -11,24 +11,28 @@
 #endif
 
 using namespace mozilla;
 using namespace mozilla::gl;
 
 NS_IMPL_ISUPPORTS(GfxTexturesReporter, nsIMemoryReporter)
 
 Atomic<size_t> GfxTexturesReporter::sAmount(0);
+Atomic<size_t> GfxTexturesReporter::sPeakAmount(0);
 Atomic<size_t> GfxTexturesReporter::sTileWasteAmount(0);
 
 /* static */ void
 GfxTexturesReporter::UpdateAmount(MemoryUse action, size_t amount)
 {
     if (action == MemoryFreed) {
         MOZ_RELEASE_ASSERT(amount <= sAmount);
         sAmount -= amount;
     } else {
         sAmount += amount;
+        if (sAmount > sPeakAmount) {
+            sPeakAmount.exchange(sAmount);
+        }
     }
 
 #ifdef MOZ_CRASHREPORTER
     CrashReporter::AnnotateTexturesSize(sAmount);
 #endif
 }
--- a/gfx/gl/GfxTexturesReporter.h
+++ b/gfx/gl/GfxTexturesReporter.h
@@ -48,23 +48,28 @@ public:
     }
 
     NS_IMETHOD CollectReports(nsIHandleReportCallback* aHandleReport,
                               nsISupports* aData, bool aAnonymize) override
     {
         MOZ_COLLECT_REPORT("gfx-tiles-waste", KIND_OTHER, UNITS_BYTES,
             int64_t(sTileWasteAmount),
             "Memory lost due to tiles extending past content boundaries");
-        return MOZ_COLLECT_REPORT(
+        MOZ_COLLECT_REPORT(
             "gfx-textures", KIND_OTHER, UNITS_BYTES, int64_t(sAmount),
             "Memory used for storing GL textures.");
+        MOZ_COLLECT_REPORT(
+            "gfx-textures-peak", KIND_OTHER, UNITS_BYTES, int64_t(sPeakAmount),
+            "Peak memory used for storing GL textures.");
+        return NS_OK;
     }
 
 private:
     static Atomic<size_t> sAmount;
+    static Atomic<size_t> sPeakAmount;
     // Count the amount of memory lost to tile waste
     static Atomic<size_t> sTileWasteAmount;
 };
 
 class GfxTextureWasteTracker {
 public:
   GfxTextureWasteTracker()
     : mBytes(0)