mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 14:55:47 +00:00
Bug 689256 - Record invalid PROCESS_CREATION timestamps and adjust tests to cope with them. r=glandium
This commit is contained in:
parent
6140c88aea
commit
9bddf57614
@ -1,7 +1,17 @@
|
|||||||
function test() {
|
function test() {
|
||||||
var startup_info = Components.classes["@mozilla.org/toolkit/app-startup;1"].getService(Components.interfaces.nsIAppStartup).getStartupInfo();
|
var startup_info = Components.classes["@mozilla.org/toolkit/app-startup;1"].getService(Components.interfaces.nsIAppStartup).getStartupInfo();
|
||||||
// No .process info on mac
|
// No .process info on mac
|
||||||
ok(startup_info.process <= startup_info.main, "process created before main is run " + uneval(startup_info));
|
|
||||||
|
// Check if we encountered a telemetry error for the the process creation
|
||||||
|
// timestamp and turn the first test into a known failure.
|
||||||
|
var telemetry = Cc["@mozilla.org/base/telemetry;1"].getService(Ci.nsITelemetry);
|
||||||
|
var snapshot = telemetry.getHistogramById("STARTUP_MEASUREMENT_ERRORS")
|
||||||
|
.snapshot();
|
||||||
|
|
||||||
|
if (snapshot.counts[0] == 0)
|
||||||
|
ok(startup_info.process <= startup_info.main, "process created before main is run " + uneval(startup_info));
|
||||||
|
else
|
||||||
|
todo(false, "An error occurred while recording the process creation timestamp, skipping this test");
|
||||||
|
|
||||||
// on linux firstPaint can happen after everything is loaded (especially with remote X)
|
// on linux firstPaint can happen after everything is loaded (especially with remote X)
|
||||||
if (startup_info.firstPaint)
|
if (startup_info.firstPaint)
|
||||||
|
@ -791,14 +791,17 @@ nsAppStartup::GetStartupInfo(JSContext* aCx, JS::Value* aRetval)
|
|||||||
PRTime ProcessCreationTimestamp = StartupTimeline::Get(StartupTimeline::PROCESS_CREATION);
|
PRTime ProcessCreationTimestamp = StartupTimeline::Get(StartupTimeline::PROCESS_CREATION);
|
||||||
|
|
||||||
if (!ProcessCreationTimestamp) {
|
if (!ProcessCreationTimestamp) {
|
||||||
|
PRTime MainTimestamp = StartupTimeline::Get(StartupTimeline::MAIN);
|
||||||
char *moz_app_restart = PR_GetEnv("MOZ_APP_RESTART");
|
char *moz_app_restart = PR_GetEnv("MOZ_APP_RESTART");
|
||||||
if (moz_app_restart) {
|
if (moz_app_restart) {
|
||||||
ProcessCreationTimestamp = nsCRT::atoll(moz_app_restart) * PR_USEC_PER_MSEC;
|
ProcessCreationTimestamp = nsCRT::atoll(moz_app_restart) * PR_USEC_PER_MSEC;
|
||||||
} else {
|
} else {
|
||||||
ProcessCreationTimestamp = CalculateProcessCreationTimestamp();
|
ProcessCreationTimestamp = CalculateProcessCreationTimestamp();
|
||||||
}
|
}
|
||||||
// Bug 670008: Avoid obviously invalid process creation times
|
// Bug 670008 & 689256: Avoid obviously invalid process creation times
|
||||||
if (PR_Now() <= ProcessCreationTimestamp) {
|
if ((PR_Now() <= ProcessCreationTimestamp) ||
|
||||||
|
(ProcessCreationTimestamp > MainTimestamp))
|
||||||
|
{
|
||||||
ProcessCreationTimestamp = -1;
|
ProcessCreationTimestamp = -1;
|
||||||
Telemetry::Accumulate(Telemetry::STARTUP_MEASUREMENT_ERRORS, StartupTimeline::PROCESS_CREATION);
|
Telemetry::Accumulate(Telemetry::STARTUP_MEASUREMENT_ERRORS, StartupTimeline::PROCESS_CREATION);
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ let tmp = {};
|
|||||||
Components.utils.import("resource://gre/modules/AddonRepository.jsm", tmp);
|
Components.utils.import("resource://gre/modules/AddonRepository.jsm", tmp);
|
||||||
let AddonRepository = tmp.AddonRepository;
|
let AddonRepository = tmp.AddonRepository;
|
||||||
|
|
||||||
|
var gTelemetry = Cc["@mozilla.org/base/telemetry;1"].getService(Ci.nsITelemetry);
|
||||||
var gManagerWindow;
|
var gManagerWindow;
|
||||||
var gProvider;
|
var gProvider;
|
||||||
|
|
||||||
@ -41,13 +42,38 @@ function test() {
|
|||||||
}
|
}
|
||||||
info(url.query);
|
info(url.query);
|
||||||
|
|
||||||
|
// Check if we encountered telemetry errors and turn the tests for which
|
||||||
|
// we don't have valid data into known failures.
|
||||||
|
let snapshot = gTelemetry.getHistogramById("STARTUP_MEASUREMENT_ERRORS")
|
||||||
|
.snapshot();
|
||||||
|
|
||||||
|
let tProcessValid = (snapshot.counts[0] == 0);
|
||||||
|
let tMainValid = tProcessValid && (snapshot.counts[2] == 0);
|
||||||
|
let tFirstPaintValid = tProcessValid && (snapshot.counts[5] == 0);
|
||||||
|
let tSessionRestoredValid = tProcessValid && (snapshot.counts[6] == 0);
|
||||||
|
|
||||||
let params = parseParams(url.query);
|
let params = parseParams(url.query);
|
||||||
|
|
||||||
is(params.appOS, Services.appinfo.OS, "OS should be correct");
|
is(params.appOS, Services.appinfo.OS, "OS should be correct");
|
||||||
is(params.appVersion, Services.appinfo.version, "Version should be correct");
|
is(params.appVersion, Services.appinfo.version, "Version should be correct");
|
||||||
ok(params.tMain >= 0, "Should be a sensible tMain");
|
|
||||||
ok(params.tFirstPaint >= 0, "Should be a sensible tFirstPaint");
|
if (tMainValid) {
|
||||||
ok(params.tSessionRestored >= 0, "Should be a sensible tSessionRestored");
|
ok(params.tMain >= 0, "Should be a sensible tMain");
|
||||||
|
} else {
|
||||||
|
todo(false, "An error occurred while recording the startup timestamps, skipping this test");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tFirstPaintValid) {
|
||||||
|
ok(params.tFirstPaint >= 0, "Should be a sensible tFirstPaint");
|
||||||
|
} else {
|
||||||
|
todo(false, "An error occurred while recording the startup timestamps, skipping this test");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tSessionRestoredValid) {
|
||||||
|
ok(params.tSessionRestored >= 0, "Should be a sensible tSessionRestored");
|
||||||
|
} else {
|
||||||
|
todo(false, "An error occurred while recording the startup timestamps, skipping this test");
|
||||||
|
}
|
||||||
|
|
||||||
gSeenRequest = true;
|
gSeenRequest = true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user