From 5bb4252ff60424c915d32c18e38f270e325724f7 Mon Sep 17 00:00:00 2001 From: Seth Fowler Date: Fri, 24 Jun 2016 23:22:29 -0700 Subject: [PATCH] Bug 1281680 - Add telemetry for image optimizations that may no longer be useful. r=edwin --- image/imgFrame.cpp | 16 ++++++++++++---- toolkit/components/telemetry/Histograms.json | 14 ++++++++++++++ 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/image/imgFrame.cpp b/image/imgFrame.cpp index 60f7fafe08de..0c3068af24c0 100644 --- a/image/imgFrame.cpp +++ b/image/imgFrame.cpp @@ -16,13 +16,14 @@ #include "gfxAlphaRecovery.h" #include "GeckoProfiler.h" -#include "mozilla/Likely.h" #include "MainThreadUtils.h" -#include "mozilla/MemoryReporting.h" -#include "nsMargin.h" -#include "nsThreadUtils.h" #include "mozilla/CheckedInt.h" #include "mozilla/gfx/Tools.h" +#include "mozilla/Likely.h" +#include "mozilla/MemoryReporting.h" +#include "mozilla/Telemetry.h" +#include "nsMargin.h" +#include "nsThreadUtils.h" namespace mozilla { @@ -397,12 +398,19 @@ imgFrame::Optimize() // 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 buf = AllocateBufferForImage(mFrameRect.Size(), optFormat); if (!buf) { diff --git a/toolkit/components/telemetry/Histograms.json b/toolkit/components/telemetry/Histograms.json index 29ff170c0d81..2ed59af1a3f5 100644 --- a/toolkit/components/telemetry/Histograms.json +++ b/toolkit/components/telemetry/Histograms.json @@ -1058,6 +1058,20 @@ "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",