зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1135076 - Missing histograms in childPayloads. r=vladan
--HG-- extra : rebase_source : 997a36b9375d054406b51fae768bc01a2d75fe46
This commit is contained in:
Родитель
7a3551f637
Коммит
3bf473920f
|
@ -4338,6 +4338,12 @@
|
|||
"extended_statistics_ok": true,
|
||||
"description": "Number of histograms with total count low errors"
|
||||
},
|
||||
"TELEMETRY_DISCARDED_CONTENT_PINGS_COUNT": {
|
||||
"alert_emails": ["perf-telemetry-alerts@mozilla.com"],
|
||||
"expires_in_version": "never",
|
||||
"kind": "count",
|
||||
"description": "Count of discarded content payloads."
|
||||
},
|
||||
"TELEMETRY_FILES_EVICTED": {
|
||||
"alert_emails": ["rvitillo@mozilla.com"],
|
||||
"expires_in_version": "36",
|
||||
|
|
|
@ -1805,7 +1805,8 @@ TelemetryImpl::AsyncFetchTelemetryData(nsIFetchTelemetryDataCallback *aCallback)
|
|||
|
||||
TelemetryImpl::TelemetryImpl():
|
||||
mHistogramMap(Telemetry::HistogramCount),
|
||||
mCanRecord(XRE_GetProcessType() == GeckoProcessType_Default),
|
||||
mCanRecord(XRE_GetProcessType() == GeckoProcessType_Default ||
|
||||
XRE_GetProcessType() == GeckoProcessType_Content),
|
||||
mHashMutex("Telemetry::mHashMutex"),
|
||||
mHangReportsMutex("Telemetry::mHangReportsMutex"),
|
||||
mThreadHangStatsMutex("Telemetry::mThreadHangStatsMutex"),
|
||||
|
|
|
@ -64,9 +64,13 @@ const PREF_FHR_UPLOAD_ENABLED = "datareporting.healthreport.uploadEnabled";
|
|||
const PREF_ASYNC_PLUGIN_INIT = "dom.ipc.plugins.asyncInit";
|
||||
|
||||
const MESSAGE_TELEMETRY_PAYLOAD = "Telemetry:Payload";
|
||||
const MESSAGE_TELEMETRY_GET_CHILD_PAYLOAD = "Telemetry:GetChildPayload";
|
||||
|
||||
const SESSION_STATE_FILE_NAME = "session-state.json";
|
||||
|
||||
// Maximum number of content payloads that we are willing to store.
|
||||
const MAX_NUM_CONTENT_PAYLOADS = 10;
|
||||
|
||||
// Do not gather data more than once a minute
|
||||
const TELEMETRY_INTERVAL = 60000;
|
||||
// Delay before intializing telemetry (ms)
|
||||
|
@ -98,7 +102,13 @@ XPCOMUtils.defineLazyServiceGetter(this, "idleService",
|
|||
XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
|
||||
"@mozilla.org/childprocessmessagemanager;1",
|
||||
"nsIMessageSender");
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "cpml",
|
||||
"@mozilla.org/childprocessmessagemanager;1",
|
||||
"nsIMessageListenerManager");
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
|
||||
"@mozilla.org/parentprocessmessagemanager;1",
|
||||
"nsIMessageBroadcaster");
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "ppml",
|
||||
"@mozilla.org/parentprocessmessagemanager;1",
|
||||
"nsIMessageListenerManager");
|
||||
|
||||
|
@ -352,6 +362,13 @@ this.TelemetrySession = Object.freeze({
|
|||
getPayload: function(reason, clearSubsession = false) {
|
||||
return Impl.getPayload(reason, clearSubsession);
|
||||
},
|
||||
/**
|
||||
* Asks the content processes to send their payloads.
|
||||
* @returns Object
|
||||
*/
|
||||
requestChildPayloads: function() {
|
||||
return Impl.requestChildPayloads();
|
||||
},
|
||||
/**
|
||||
* Save histograms to a file.
|
||||
* Used only for testing purposes.
|
||||
|
@ -1127,7 +1144,7 @@ let Impl = {
|
|||
this._hasWindowRestoredObserver = true;
|
||||
this._hasXulWindowVisibleObserver = true;
|
||||
|
||||
ppmm.addMessageListener(MESSAGE_TELEMETRY_PAYLOAD, this);
|
||||
ppml.addMessageListener(MESSAGE_TELEMETRY_PAYLOAD, this);
|
||||
|
||||
// Delay full telemetry initialization to give the browser time to
|
||||
// run various late initializers. Otherwise our gathered memory
|
||||
|
@ -1178,6 +1195,7 @@ let Impl = {
|
|||
}
|
||||
|
||||
Services.obs.addObserver(this, "content-child-shutdown", false);
|
||||
cpml.addMessageListener(MESSAGE_TELEMETRY_GET_CHILD_PAYLOAD, this);
|
||||
|
||||
this.gatherStartupHistograms();
|
||||
|
||||
|
@ -1209,9 +1227,11 @@ let Impl = {
|
|||
switch (message.name) {
|
||||
case MESSAGE_TELEMETRY_PAYLOAD:
|
||||
{
|
||||
let target = message.target;
|
||||
let source = message.data.childUUID;
|
||||
delete message.data.childUUID;
|
||||
|
||||
for (let child of this._childTelemetry) {
|
||||
if (child.source.get() === target) {
|
||||
if (child.source === source) {
|
||||
// Update existing telemetry data.
|
||||
child.payload = message.data;
|
||||
return;
|
||||
|
@ -1219,9 +1239,20 @@ let Impl = {
|
|||
}
|
||||
// Did not find existing child in this._childTelemetry.
|
||||
this._childTelemetry.push({
|
||||
source: Cu.getWeakReference(target),
|
||||
source: source,
|
||||
payload: message.data,
|
||||
});
|
||||
|
||||
if (this._childTelemetry.length == MAX_NUM_CONTENT_PAYLOADS + 1) {
|
||||
this._childTelemetry.shift();
|
||||
Telemetry.getHistogramById("TELEMETRY_DISCARDED_CONTENT_PINGS_COUNT").add();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case MESSAGE_TELEMETRY_GET_CHILD_PAYLOAD:
|
||||
{
|
||||
this.sendContentProcessPing("saved-session");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -1229,10 +1260,13 @@ let Impl = {
|
|||
}
|
||||
},
|
||||
|
||||
_processUUID: generateUUID(),
|
||||
|
||||
sendContentProcessPing: function sendContentProcessPing(reason) {
|
||||
this._log.trace("sendContentProcessPing - Reason " + reason);
|
||||
const isSubsession = !this._isClassicReason(reason);
|
||||
let payload = this.getSessionPayload(reason, isSubsession);
|
||||
payload.childUUID = this._processUUID;
|
||||
cpmm.sendAsyncMessage(MESSAGE_TELEMETRY_PAYLOAD, payload);
|
||||
},
|
||||
|
||||
|
@ -1291,6 +1325,11 @@ let Impl = {
|
|||
return this.getSessionPayload(reason, clearSubsession);
|
||||
},
|
||||
|
||||
requestChildPayloads: function() {
|
||||
this._log.trace("requestChildPayloads");
|
||||
ppmm.broadcastAsyncMessage(MESSAGE_TELEMETRY_GET_CHILD_PAYLOAD, {});
|
||||
},
|
||||
|
||||
gatherStartup: function gatherStartup() {
|
||||
this._log.trace("gatherStartup");
|
||||
let counters = processInfo.getCounters();
|
||||
|
|
Загрузка…
Ссылка в новой задаче