Bug 684091. Keep a histogram of how often we've decoded images. r=jlebar

This will help track if we're decoding the right amount. e.g. if we
try to decode less we should see changes here.
This commit is contained in:
Jeff Muizelaar 2011-09-08 14:05:11 -04:00
parent fa337a58c6
commit 9d4bfca227
4 changed files with 15 additions and 0 deletions

View File

@ -78,6 +78,7 @@ LOCAL_INCLUDES += \
LOCAL_INCLUDES += -I$(topsrcdir)/layout/svg/base/src
include $(topsrcdir)/config/rules.mk
include $(topsrcdir)/ipc/chromium/chromium-config.mk
# Because imgFrame.cpp includes "cairo.h"
CXXFLAGS += $(MOZ_CAIRO_CFLAGS)

View File

@ -42,6 +42,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "base/histogram.h"
#include "nsComponentManagerUtils.h"
#include "imgIContainerObserver.h"
#include "ImageErrors.h"
@ -191,6 +192,7 @@ RasterImage::RasterImage(imgStatusTracker* aStatusTracker) :
mDecoder(nsnull),
mWorker(nsnull),
mBytesDecoded(0),
mDecodeCount(0),
#ifdef DEBUG
mFramesNotified(0),
#endif
@ -208,6 +210,7 @@ RasterImage::RasterImage(imgStatusTracker* aStatusTracker) :
// Set up the discard tracker node.
mDiscardTrackerNode.curr = this;
mDiscardTrackerNode.prev = mDiscardTrackerNode.next = nsnull;
Telemetry::GetHistogramById(Telemetry::IMAGE_DECODE_COUNT)->Add(0);
// Statistics
num_containers++;
@ -2197,6 +2200,12 @@ RasterImage::InitDecoder(bool aDoSizeDecode)
// Create a decode worker
mWorker = new imgDecodeWorker(this);
if (!aDoSizeDecode) {
Telemetry::GetHistogramById(Telemetry::IMAGE_DECODE_COUNT)->Subtract(mDecodeCount);
mDecodeCount++;
Telemetry::GetHistogramById(Telemetry::IMAGE_DECODE_COUNT)->Add(mDecodeCount);
}
CONTAINER_ENSURE_TRUE(mWorker, NS_ERROR_OUT_OF_MEMORY);
return NS_OK;

View File

@ -503,6 +503,10 @@ private: // data
nsRefPtr<imgDecodeWorker> mWorker;
PRUint32 mBytesDecoded;
// How many times we've decoded this image.
// This is currently only used for statistics
PRInt32 mDecodeCount;
#ifdef DEBUG
PRUint32 mFramesNotified;
#endif

View File

@ -97,6 +97,7 @@ HISTOGRAM(IMAGE_DECODE_LATENCY, 50, 5000000, 100, EXPONENTIAL, "Time spent deco
HISTOGRAM(IMAGE_DECODE_TIME, 50, 50000000, 100, EXPONENTIAL, "Time spent decoding an image (us)")
HISTOGRAM(IMAGE_DECODE_ON_DRAW_LATENCY, 50, 50000000, 100, EXPONENTIAL, "Time from starting a decode to it showing up on the screen (us)")
HISTOGRAM(IMAGE_DECODE_CHUNKS, 1, 500, 50, EXPONENTIAL, "Number of chunks per decode attempt")
HISTOGRAM(IMAGE_DECODE_COUNT, 1, 500, 50, EXPONENTIAL, "Decode count")
/**
* Networking telemetry