Bug 1281680 - Add telemetry for image optimizations that may no longer be useful. r=edwin
authorSeth Fowler <mark.seth.fowler@gmail.com>
Fri, 24 Jun 2016 23:22:29 -0700
changeset 302632 6a0632dcd94b8a5efbd80e59e2fb12188becc440
parent 302631 b7e8b25f0e255f56968558da9dcfd0804c43e1a6
child 302653 d9d294e3a5fd58b16d85f81665d880da46841377
push id78808
push usermfowler@mozilla.com
push dateSat, 25 Jun 2016 22:41:29 +0000
treeherdermozilla-inbound@6a0632dcd94b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersedwin
bugs1281680
milestone50.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 1281680 - Add telemetry for image optimizations that may no longer be useful. r=edwin
image/imgFrame.cpp
toolkit/components/telemetry/Histograms.json
--- a/image/imgFrame.cpp
+++ b/image/imgFrame.cpp
@@ -11,23 +11,24 @@
 #include "prenv.h"
 
 #include "gfx2DGlue.h"
 #include "gfxPlatform.h"
 #include "gfxUtils.h"
 #include "gfxAlphaRecovery.h"
 
 #include "GeckoProfiler.h"
+#include "MainThreadUtils.h"
+#include "mozilla/CheckedInt.h"
+#include "mozilla/gfx/Tools.h"
 #include "mozilla/Likely.h"
-#include "MainThreadUtils.h"
 #include "mozilla/MemoryReporting.h"
+#include "mozilla/Telemetry.h"
 #include "nsMargin.h"
 #include "nsThreadUtils.h"
-#include "mozilla/CheckedInt.h"
-#include "mozilla/gfx/Tools.h"
 
 
 namespace mozilla {
 
 using namespace gfx;
 
 namespace image {
 
@@ -392,22 +393,29 @@ imgFrame::Optimize()
         return NS_OK;
       }
     }
 
     // if it's not RGB24/ARGB32, don't optimize, but we never hit this at the
     // moment
   }
 
+  const bool usedSingleColorOptimizationUsefully = mSinglePixel &&
+                                                   mFrameRect.Area() > 1;
+  Telemetry::Accumulate(Telemetry::IMAGE_OPTIMIZE_TO_SINGLE_COLOR_USED,
+                        usedSingleColorOptimizationUsefully);
+
 #ifdef ANDROID
   SurfaceFormat optFormat = gfxPlatform::GetPlatform()
     ->Optimal2DFormatForContent(gfxContentType::COLOR);
 
   if (mFormat != SurfaceFormat::B8G8R8A8 &&
       optFormat == SurfaceFormat::R5G6B5_UINT16) {
+    Telemetry::Accumulate(Telemetry::IMAGE_OPTIMIZE_TO_565_USED, true);
+
     RefPtr<VolatileBuffer> buf =
       AllocateBufferForImage(mFrameRect.Size(), optFormat);
     if (!buf) {
       return NS_OK;
     }
 
     RefPtr<DataSourceSurface> surf =
       CreateLockedSurface(buf, mFrameRect.Size(), optFormat);
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -1053,16 +1053,30 @@
   "IMAGE_DECODE_SPEED_PNG": {
     "expires_in_version": "never",
     "kind": "exponential",
     "low": 500,
     "high": 50000000,
     "n_buckets": 50,
     "description": "PNG image decode speed (Kbytes/sec)"
   },
+  "IMAGE_OPTIMIZE_TO_SINGLE_COLOR_USED": {
+    "expires_in_version": "54",
+    "kind": "boolean",
+    "description": "Records true each time a decoded image is optimized to a single color.",
+    "alert_emails": ["seth@mozilla.com"],
+    "bug_numbers": [1281680]
+  },
+  "IMAGE_OPTIMIZE_TO_565_USED": {
+    "expires_in_version": "54",
+    "kind": "boolean",
+    "description": "Records true each time a decoded image is optimized to R5G6B5 format.",
+    "alert_emails": ["seth@mozilla.com"],
+    "bug_numbers": [1281680]
+  },
   "CANVAS_2D_USED": {
     "expires_in_version": "never",
     "kind": "boolean",
     "description": "2D canvas used"
   },
   "CANVAS_WEBGL_ACCL_FAILURE_ID": {
     "alert_emails": ["gfx-telemetry-alerts@mozilla.com","bgirard@mozilla.com","msreckovic@mozilla.com"],
     "expires_in_version": "never",