author | Nathan Froyd <froydnj@mozilla.com> |
Tue, 25 Sep 2012 13:48:57 -0400 | |
changeset 108307 | 96fd99a249cd6519567c766b2e696ffa61e2a363 |
parent 108306 | 08764617f060d869e0fd552363c7823bd2b478ca |
child 108308 | ac136b93a1a343276991a444107a56fdcd6b1f2c |
push id | 23552 |
push user | ryanvm@gmail.com |
push date | Fri, 28 Sep 2012 03:05:08 +0000 |
treeherder | mozilla-central@2d96ee8d9dd4 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | taras |
bugs | 783054 |
milestone | 18.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/toolkit/components/telemetry/Histograms.json +++ b/toolkit/components/telemetry/Histograms.json @@ -2245,10 +2245,14 @@ }, "SOCIAL_TOGGLED": { "kind": "boolean", "description": "Social has been toggled to on or off" }, "ENABLE_PRIVILEGE_EVER_CALLED": { "kind": "flag", "description": "Whether enablePrivilege has ever been called during the current session" + }, + "READ_SAVED_PING_SUCCESS": { + "kind": "boolean", + "description": "Sucessful reading a saved ping file" } }
--- a/toolkit/components/telemetry/TelemetryPing.js +++ b/toolkit/components/telemetry/TelemetryPing.js @@ -715,35 +715,40 @@ TelemetryPing.prototype = { return true; } let checksumNow = this.hashString(ping.payload); return ping.checksum == checksumNow; }, addToPendingPings: function addToPendingPings(file, stream) { + let success = false; + try { let string = NetUtil.readInputStreamToString(stream, stream.available(), { charset: "UTF-8" }); stream.close(); let ping = JSON.parse(string); this._pingLoadsCompleted++; if (this.verifyPingChecksum(ping)) { this._pendingPings.push(ping); } if (this._doLoadSaveNotifications && this._pingLoadsCompleted == this._pingsLoaded) { Services.obs.notifyObservers(null, "telemetry-test-load-complete", null); } + success = true; } catch (e) { // An error reading the file, or an error parsing the contents. stream.close(); // close is idempotent. file.remove(true); } + let success_histogram = Telemetry.getHistogramById("READ_SAVED_PING_SUCCESS"); + success_histogram.add(success); }, loadHistograms: function loadHistograms(file, sync) { this._pingsLoaded++; if (sync) { let stream = Cc["@mozilla.org/network/file-input-stream;1"] .createInstance(Ci.nsIFileInputStream); stream.init(file, -1, -1, 0);
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryPing.js +++ b/toolkit/components/telemetry/tests/unit/test_TelemetryPing.js @@ -185,17 +185,19 @@ function checkPayload(request, reason, s if (isWindows) { do_check_true(payload.simpleMeasurements.startupSessionRestoreReadBytes > 0); do_check_true(payload.simpleMeasurements.startupSessionRestoreWriteBytes > 0); } const TELEMETRY_PING = "TELEMETRY_PING"; const TELEMETRY_SUCCESS = "TELEMETRY_SUCCESS"; const TELEMETRY_TEST_FLAG = "TELEMETRY_TEST_FLAG"; + const READ_SAVED_PING_SUCCESS = "READ_SAVED_PING_SUCCESS"; do_check_true(TELEMETRY_PING in payload.histograms); + do_check_true(READ_SAVED_PING_SUCCESS in payload.histograms); let rh = Telemetry.registeredHistograms; for (let name in rh) { if (/SQLITE/.test(name) && name in payload.histograms) { do_check_true(("STARTUP_" + name) in payload.histograms); } } do_check_false(IGNORE_HISTOGRAM in payload.histograms); do_check_false(IGNORE_CLONED_HISTOGRAM in payload.histograms); @@ -217,16 +219,19 @@ function checkPayload(request, reason, s bucket_count: 3, histogram_type: 2, values: {0:1, 1:successfulPings, 2:0}, sum: successfulPings }; let tc = payload.histograms[TELEMETRY_SUCCESS]; do_check_eq(uneval(tc), uneval(expected_tc)); + let h = payload.histograms[READ_SAVED_PING_SUCCESS]; + do_check_eq(h.values[0], 1); + // The ping should include data from memory reporters. We can't check that // this data is correct, because we can't control the values returned by the // memory reporters. But we can at least check that the data is there. // // It's important to check for the presence of reporters with a mix of units, // because TelemetryPing has separate logic for each one. But we can't // currently check UNITS_COUNT_CUMULATIVE or UNITS_PERCENTAGE because // Telemetry doesn't touch a memory reporter with these units that's