Bug 852452 - Measure how long SessionStore writing blocks the main thread;r=ttaubert

This commit is contained in:
David Rajchenbach-Teller 2013-03-20 09:15:24 +01:00
parent 87feff8212
commit 413a6dee87
2 changed files with 15 additions and 1 deletions

View File

@ -202,13 +202,20 @@ let SessionFileInternal = {
let self = this;
return TaskUtils.spawn(function task() {
TelemetryStopwatch.start("FX_SESSION_RESTORE_WRITE_FILE_MS", refObj);
TelemetryStopwatch.start("FX_SESSION_RESTORE_WRITE_FILE_LONGEST_OP_MS", refObj);
let bytes = gEncoder.encode(aData);
try {
yield OS.File.writeAtomic(self.path, bytes, {tmpPath: self.path + ".tmp"});
let promise = OS.File.writeAtomic(self.path, bytes, {tmpPath: self.path + ".tmp"});
// At this point, we measure how long we stop the main thread
TelemetryStopwatch.finish("FX_SESSION_RESTORE_WRITE_FILE_LONGEST_OP_MS", refObj);
// Now wait for the result and measure how long we had to wait for the result
yield promise;
TelemetryStopwatch.finish("FX_SESSION_RESTORE_WRITE_FILE_MS", refObj);
} catch (ex) {
TelemetryStopwatch.cancel("FX_SESSION_RESTORE_WRITE_FILE_LONGEST_OP_MS", refObj);
TelemetryStopwatch.cancel("FX_SESSION_RESTORE_WRITE_FILE_MS", refObj);
Cu.reportError("Could not write session state file " + self.path
+ ": " + aReason);

View File

@ -2461,6 +2461,13 @@
"extended_statistics_ok": true,
"description": "Session restore: Time to write the session data to the file on disk (ms)"
},
"FX_SESSION_RESTORE_WRITE_FILE_LONGEST_OP_MS": {
"kind": "exponential",
"high": "3000",
"n_buckets": 10,
"extended_statistics_ok": true,
"description": "Session restore: Duration of the longest uninterruptible operation while writing session data (ms)"
},
"FX_SESSION_RESTORE_CORRUPT_FILE": {
"kind": "boolean",
"description": "Session restore: Whether the file read on startup contained parse-able JSON"