Bug 1347400 - Add telemetry for imgLoader::LoadImage(); r=mystor,francois

This commit is contained in:
Ehsan Akhgari 2017-03-15 00:12:07 -04:00
Родитель a0ef36e101
Коммит f4a03626ab
2 изменённых файлов: 21 добавлений и 1 удалений

Просмотреть файл

@ -12,6 +12,7 @@
#include "mozilla/Move.h"
#include "mozilla/Preferences.h"
#include "mozilla/ChaosMode.h"
#include "mozilla/Telemetry.h"
#include "nsImageModule.h"
#include "imgRequestProxy.h"
@ -2063,6 +2064,12 @@ imgLoader::LoadImage(nsIURI* aURI,
const nsAString& initiatorType,
imgRequestProxy** _retval)
{
// Note: We round the time to the nearest milliseconds. Due to this rounding,
// the actual minimum value is 500 microseconds.
static const uint32_t kMinTelemetryLatencyMs = 1;
mozilla::TimeStamp start = TimeStamp::Now();
VerifyCacheSizes();
NS_ASSERTION(aURI, "imgLoader::LoadImage -- NULL URI pointer");
@ -2298,8 +2305,11 @@ imgLoader::LoadImage(nsIURI* aURI,
if (!newChannel) {
proxy->NotifyListener();
}
}
return rv;
uint32_t latencyMs = round((TimeStamp::Now() - start).ToMilliseconds());
if (XRE_IsContentProcess() && latencyMs >= kMinTelemetryLatencyMs) {
Telemetry::Accumulate(Telemetry::IMAGE_LOAD_TRIGGER_LATENCY_MS, latencyMs);
}
NS_ASSERTION(*_retval, "imgLoader::LoadImage -- no return value");

Просмотреть файл

@ -1482,6 +1482,16 @@
"n_buckets": 50,
"description": "GIF image decode speed (Kbytes/sec)"
},
"IMAGE_LOAD_TRIGGER_LATENCY_MS": {
"alert_emails": ["ehsan@mozilla.com"],
"expires_in_version": "60",
"bug_numbers": [1347376],
"kind": "exponential",
"low": 1,
"high": 1000,
"n_buckets": 50,
"description": "Measures the number of milliseconds we spend inside imgLoader::LoadImage(). Note: only calls that take more than 500 microseconds and happen in the content process are included in this probe."
},
"IMAGE_DECODE_SPEED_PNG": {
"expires_in_version": "never",
"kind": "exponential",