Bug 664758 - Add page fault reporting to telemetry. r=taras

--HG--
extra : rebase_source : 89d0936181a705d3d6ec7ceab8648b6694989d20
This commit is contained in:
Justin Lebar 2011-06-16 14:38:23 -04:00
parent 5daed65b45
commit bb227a874b
3 changed files with 42 additions and 10 deletions

View File

@ -37,9 +37,11 @@
* ***** END LICENSE BLOCK ***** */
/**
* This file lists Telemetry histograms collected by Firefox. Format
* is HISTOGRAM(id, minium, maximum, bucket count, histogram kind,
* human-readable description for about:telemetry)
* This file lists Telemetry histograms collected by Firefox. The format is
*
* HISTOGRAM(id, minium, maximum, bucket count, histogram kind,
* human-readable description for about:telemetry)
*
*/
HISTOGRAM(CYCLE_COLLECTOR, 1, 10000, 50, EXPONENTIAL, "Time(ms) spent on cycle collection")
@ -56,5 +58,6 @@ HISTOGRAM(GLUESTARTUP_READ_TRANSFER, 1, 50 * 1024, 12, EXPONENTIAL, "ProcessIoCo
#elif defined(XP_UNIX)
HISTOGRAM(EARLY_GLUESTARTUP_HARD_FAULTS, 1, 100, 12, LINEAR, "Hard faults count before glue startup")
HISTOGRAM(GLUESTARTUP_HARD_FAULTS, 1, 500, 12, EXPONENTIAL, "Hard faults count after glue startup")
HISTOGRAM(HARD_PAGE_FAULTS, 8, 64 * 1024, 13, EXPONENTIAL, "Hard page faults (since last telemetry ping)")
#endif
HISTOGRAM(ZIPARCHIVE_CRC, 0, 1, 2, BOOLEAN, "Zip item CRC check pass")

View File

@ -56,7 +56,8 @@ const TELEMETRY_DELAY = 60000;
const MEM_HISTOGRAMS = {
"explicit/js/gc-heap": "MEMORY_JS_GC_HEAP",
"resident": "MEMORY_RESIDENT",
"explicit/layout/all": "MEMORY_LAYOUT_ALL"
"explicit/layout/all": "MEMORY_LAYOUT_ALL",
"hard-page-faults": "HARD_PAGE_FAULTS"
};
XPCOMUtils.defineLazyGetter(this, "Telemetry", function () {
@ -184,6 +185,7 @@ function TelemetryPing() {}
TelemetryPing.prototype = {
_histograms: {},
_prevValues: {},
/**
* Pull values from about:memory into corresponding histograms
@ -195,7 +197,7 @@ TelemetryPing.prototype = {
getService(Ci.nsIMemoryReporterManager);
} catch (e) {
// OK to skip memory reporters in xpcshell
return
return;
}
let e = mgr.enumerateReporters();
@ -208,14 +210,41 @@ TelemetryPing.prototype = {
continue;
}
let name = "Memory:" + mr.path + " (KB)";
let name, val;
if (mr.units == Ci.nsIMemoryReporter.UNITS_BYTES) {
name = "Memory:" + mr.path + " + (KB)";
val = Math.floor(mr.amount / 1024);
}
else if (mr.units == Ci.nsIMemoryReporter.UNITS_COUNT) {
// If the reporter gives us a count, we'll report the difference in its
// value between now and our previous ping.
name = "Memory:" + mr.path;
// Read mr.amount just once so our arithmetic is consistent.
let curVal = mr.amount;
let prevVal = this._prevValues[mr.path];
if (!prevVal) {
// If this is the first time we're reading this reporter, store its
// current value but don't report it in the telemetry ping, so we
// ignore the effect startup had on the reporter.
this._prevValues[mr.path] = curVal;
continue;
}
val = curVal - prevVal;
this._prevValues[mr.path] = curVal;
}
else {
NS_ASSERT(false, "Can't handle memory reporter with units " + mr.units);
continue;
}
let h = this._histograms[name];
if (!h) {
h = Telemetry.getHistogramById(id);
this._histograms[name] = h;
}
let v = Math.floor(mr.amount / 1024);
h.add(v);
h.add(val);
}
return memReporters;
},
@ -250,7 +279,7 @@ TelemetryPing.prototype = {
request.overrideMimeType("text/plain");
request.setRequestHeader("Content-Type", "application/json");
let startTime = new Date()
let startTime = new Date();
function finishRequest(channel) {
let success = false;

View File

@ -87,7 +87,7 @@ function checkHistograms(request, response) {
const TELEMETRY_SUCCESS = "TELEMETRY_SUCCESS";
do_check_true(TELEMETRY_PING in payload.histograms)
// There should be one successful report from the previos telemetry ping
// There should be one successful report from the previous telemetry ping.
const expected_tc = {
range: [1, 2],
bucket_count: 3,