Bug 720456 - Include more startup-relevant information in telemetry pings. r=taras

This commit is contained in:
Nathan Froyd 2012-02-13 15:04:21 -05:00
Родитель d8d5b9654f
Коммит 9ab233744b
2 изменённых файлов: 25 добавлений и 6 удалений

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

@ -182,6 +182,9 @@ TelemetryPing.prototype = {
// Generate a unique id once per session so the server can cope with
// duplicate submissions.
_uuid: generateUUID(),
// Regex that matches histograms we carea bout during startup.
_startupHistogramRegex: /SQLITE|HTTP|SPDY|CACHE|DNS/,
_slowSQLStartup: {},
/**
* Returns a set of histograms that can be converted into JSON
@ -381,17 +384,28 @@ TelemetryPing.prototype = {
this.addValue(mr.path, id, val);
}
},
/**
* Return true if we're interested in having a STARTUP_* histogram for
* the given histogram name.
*/
isInterestingStartupHistogram: function isInterestingStartupHistogram(name) {
return this._startupHistogramRegex.test(name);
},
/**
* Make a copy of sqlite histograms on startup
* Make a copy of interesting histograms at startup.
*/
gatherStartupSqlite: function gatherStartupSqlite() {
gatherStartupInformation: function gatherStartupInformation() {
let info = Telemetry.registeredHistograms;
let sqlite_re = /SQLITE/;
let snapshots = Telemetry.histogramSnapshots;
for (let name in info) {
if (sqlite_re.test(name))
// Only duplicate histograms with actual data.
if (this.isInterestingStartupHistogram(name) && name in snapshots) {
Telemetry.histogramFrom("STARTUP_" + name, name);
}
}
this._slowSQLStartup = Telemetry.slowSQL;
},
getSessionPayloadAndSlug: function getSessionPayloadAndSlug(reason) {
@ -404,6 +418,10 @@ TelemetryPing.prototype = {
histograms: this.getHistograms(),
slowSQL: Telemetry.slowSQL
};
if (Object.keys(this._slowSQLStartup.mainThread).length
|| Object.keys(this._slowSQLStartup.otherThreads).length) {
payloadObj.slowSQLStartup = this._slowSQLStartup;
}
return { slug: slug, payload: JSON.stringify(payloadObj) };
},
@ -546,7 +564,7 @@ TelemetryPing.prototype = {
}
break;
case "sessionstore-windows-restored":
this.gatherStartupSqlite();
this.gatherStartupInformation();
break;
case "idle-daily":
// Enqueue to main-thread, otherwise components may be inited by the
@ -561,6 +579,7 @@ TelemetryPing.prototype = {
break;
case "get-payload":
this.gatherMemory();
this.gatherStartupInformation();
let data = this.getSessionPayloadAndSlug("gather-payload");
aSubject.QueryInterface(Ci.nsISupportsString).data = data.payload;

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

@ -29,8 +29,8 @@ var gFinished = false;
function telemetry_ping () {
const TelemetryPing = Cc["@mozilla.org/base/telemetry-ping;1"].getService(Ci.nsIObserver);
TelemetryPing.observe(null, "test-ping", SERVER);
TelemetryPing.observe(null, "sessionstore-windows-restored", null);
TelemetryPing.observe(null, "test-ping", SERVER);
}
function nonexistentServerObserver(aSubject, aTopic, aData) {