mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Bug 1614861 - Make slow startup notification bar sampler use monotonic clock. r=gsvelto
The slow startup notification bar sampler code was using `Date.now() - Services.startup.getStartupInfo().process`. `Services.startup.getStartupInfo().process` is a high-resolution timestamp from a monotonic clock that has been converted to a Date object. Date.now() is a timestamp from a clock that is _not guaranteed to be monotonic_, so even though they're technically the same type, Date.now() ultimately has looser guarantees on its stability. Date.now() can, for example, change if the OS communicates with a clock on a network, and updates itself - this can move the clock forward or backward. Timezone changes can also impact Date.now(). These are edge-cases, but users do hit them nonetheless. This patch switches the sampler to use `Cu.now()`, which is a high-resolution interval from process start to the current time using a monotonic clock. Differential Revision: https://phabricator.services.mozilla.com/D62760 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
e6464dd404
commit
a135d65169
@ -1255,7 +1255,7 @@ BrowserGlue.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
let currentTime = Date.now() - Services.startup.getStartupInfo().process;
|
||||
let currentTime = Math.round(Cu.now());
|
||||
let averageTime = 0;
|
||||
let samples = 0;
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user