Bug 1549519 - Add two histograms as page reload performance telemetry r=bdekoz,Gijs

Differential Revision: https://phabricator.services.mozilla.com/D31480

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Sean Feng 2019-06-05 13:56:52 +00:00
Родитель 49aab24768
Коммит eb4060b4c7
3 изменённых файлов: 52 добавлений и 9 удалений

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

@ -2326,11 +2326,11 @@ function BrowserReload() {
BrowserReloadWithFlags(reloadFlags);
}
const kSkipCacheFlags = Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_PROXY |
Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE;
function BrowserReloadSkipCache() {
// Bypass proxy and cache.
const reloadFlags = Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_PROXY |
Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE;
BrowserReloadWithFlags(reloadFlags);
BrowserReloadWithFlags(kSkipCacheFlags);
}
function BrowserHome(aEvent) {
@ -5640,24 +5640,43 @@ var TabsProgressListener = {
onStateChange(aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
// Collect telemetry data about tab load times.
if (aWebProgress.isTopLevel && (!aRequest.originalURI || aRequest.originalURI.scheme != "about")) {
let stopwatchRunning = TelemetryStopwatch.running("FX_PAGE_LOAD_MS_2", aBrowser);
let histogram = "FX_PAGE_LOAD_MS_2";
let recordLoadTelemetry = true;
if (aWebProgress.loadType & Ci.nsIDocShell.LOAD_CMD_RELOAD) {
// loadType is constructed by shifting loadFlags, this is why we need to
// do the same shifting here.
// https://searchfox.org/mozilla-central/rev/11cfa0462a6b5d8c5e2111b8cfddcf78098f0141/docshell/base/nsDocShellLoadTypes.h#22
if (aWebProgress.loadType & (kSkipCacheFlags << 16)) {
histogram = "FX_PAGE_RELOAD_SKIP_CACHE_MS";
} else if (aWebProgress.loadType == Ci.nsIDocShell.LOAD_CMD_RELOAD) {
histogram = "FX_PAGE_RELOAD_NORMAL_MS";
} else {
recordLoadTelemetry = false;
}
}
let stopwatchRunning = TelemetryStopwatch.running(histogram, aBrowser);
if (aStateFlags & Ci.nsIWebProgressListener.STATE_IS_WINDOW) {
if (aStateFlags & Ci.nsIWebProgressListener.STATE_START) {
if (stopwatchRunning) {
// Oops, we're seeing another start without having noticed the previous stop.
TelemetryStopwatch.cancel("FX_PAGE_LOAD_MS_2", aBrowser);
if (recordLoadTelemetry)
TelemetryStopwatch.cancel(histogram, aBrowser);
}
TelemetryStopwatch.start("FX_PAGE_LOAD_MS_2", aBrowser);
if (recordLoadTelemetry)
TelemetryStopwatch.start(histogram, aBrowser);
Services.telemetry.getHistogramById("FX_TOTAL_TOP_VISITS").add(true);
} else if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
stopwatchRunning /* we won't see STATE_START events for pre-rendered tabs */) {
TelemetryStopwatch.finish("FX_PAGE_LOAD_MS_2", aBrowser);
if (recordLoadTelemetry)
TelemetryStopwatch.finish(histogram, aBrowser);
}
} else if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
aStatus == Cr.NS_BINDING_ABORTED &&
stopwatchRunning /* we won't see STATE_START events for pre-rendered tabs */) {
TelemetryStopwatch.cancel("FX_PAGE_LOAD_MS_2", aBrowser);
if (recordLoadTelemetry)
TelemetryStopwatch.cancel(histogram, aBrowser);
}
}
},

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

@ -6340,6 +6340,28 @@
"alert_emails": ["tdsmith@mozilla.com", "perfteam@mozilla.com", "product-metrics-telemetry-alerts@mozilla.com"],
"releaseChannelCollection": "opt-out"
},
"FX_PAGE_RELOAD_NORMAL_MS": {
"record_in_processes": ["main"],
"expires_in_version": "never",
"kind": "linear",
"high": 10000,
"n_buckets": 200,
"description": "Firefox: Time taken to reload a page (ms) when using the LOAD_RELOAD_NORMAL flag",
"bug_numbers": [1549519],
"alert_emails": ["sefeng@mozilla.com", "perfteam@mozilla.com", "product-metrics-telemetry-alerts@mozilla.com"],
"releaseChannelCollection": "opt-out"
},
"FX_PAGE_RELOAD_SKIP_CACHE_MS": {
"record_in_processes": ["main"],
"expires_in_version": "never",
"kind": "linear",
"high": 10000,
"n_buckets": 200,
"description": "Firefox: Time taken to reload a page (ms) when caches are skipped",
"bug_numbers": [1549519],
"alert_emails": ["sefeng@mozilla.com", "perfteam@mozilla.com", "product-metrics-telemetry-alerts@mozilla.com"],
"releaseChannelCollection": "opt-out"
},
"FX_SCHEDULE_PRESSURE_IDLE_SAMPLE_MS": {
"record_in_processes": ["main"],
"expires_in_version": "61",

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

@ -1272,7 +1272,9 @@
"GC_MINOR_REASON_LONG",
"SSL_CT_POLICY_COMPLIANT_CONNECTIONS_BY_CA",
"SSL_CT_POLICY_NON_COMPLIANT_CONNECTIONS_BY_CA",
"FX_PAGE_LOAD_MS_2"
"FX_PAGE_LOAD_MS_2",
"FX_PAGE_RELOAD_NORMAL_MS",
"FX_PAGE_RELOAD_SKIP_CACHE_MS"
],
"expiry_default": [
"IDLE_NOTIFY_IDLE_MS",