Bug 825519 - Add telemetry for the max number of times any one image was decoded. r=joe

This commit is contained in:
Justin Lebar 2013-01-03 16:06:08 -05:00
parent aaacd73314
commit bd6f330cbc
2 changed files with 20 additions and 0 deletions

View File

@ -67,6 +67,10 @@ static bool gHQDownscaling = false;
// This is interpreted as a floating-point value / 1000
static uint32_t gHQDownscalingMinFactor = 1000;
// The maximum number of times any one RasterImage was decoded. This is only
// used for statistics.
static int32_t sMaxDecodeCount = 0;
static void
InitPrefCaches()
{
@ -2573,6 +2577,16 @@ RasterImage::InitDecoder(bool aDoSizeDecode)
Telemetry::GetHistogramById(Telemetry::IMAGE_DECODE_COUNT)->Subtract(mDecodeCount);
mDecodeCount++;
Telemetry::GetHistogramById(Telemetry::IMAGE_DECODE_COUNT)->Add(mDecodeCount);
if (mDecodeCount > sMaxDecodeCount) {
// Don't subtract out 0 from the histogram, because that causes its count
// to go negative, which is not kosher.
if (sMaxDecodeCount > 0) {
Telemetry::GetHistogramById(Telemetry::IMAGE_MAX_DECODE_COUNT)->Subtract(sMaxDecodeCount);
}
sMaxDecodeCount = mDecodeCount;
Telemetry::GetHistogramById(Telemetry::IMAGE_MAX_DECODE_COUNT)->Add(sMaxDecodeCount);
}
}
return NS_OK;

View File

@ -507,6 +507,12 @@
"n_buckets": 50,
"description": "Decode count"
},
"IMAGE_MAX_DECODE_COUNT": {
"kind": "exponential",
"high": "10000",
"n_buckets": 100,
"description": "Max decode count over all images"
},
"IMAGE_DECODE_SPEED_JPEG": {
"kind": "exponential",
"low": 500,