mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1747404 - [devtools] Remove unused timings.js. r=bomsy
Differential Revision: https://phabricator.services.mozilla.com/D134614
This commit is contained in:
parent
80d8efe286
commit
0577bf26d6
@ -2,7 +2,6 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
|
||||
|
||||
import * as timings from "./timings";
|
||||
import { prefs, asyncStore, features } from "./prefs";
|
||||
import { getDocument } from "./editor/source-documents";
|
||||
|
||||
@ -72,7 +71,6 @@ export function setupHelper(obj) {
|
||||
prefs,
|
||||
asyncStore,
|
||||
features,
|
||||
timings,
|
||||
getCM,
|
||||
helpers: {
|
||||
findSource: url => findSource(dbg, url),
|
||||
|
@ -47,7 +47,6 @@ CompiledModules(
|
||||
"task.js",
|
||||
"telemetry.js",
|
||||
"text.js",
|
||||
"timings.js",
|
||||
"ui.js",
|
||||
"url.js",
|
||||
"utils.js",
|
||||
|
@ -1,44 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
|
||||
|
||||
import { zip } from "lodash";
|
||||
|
||||
export function getAsyncTimes(name) {
|
||||
return zip(
|
||||
window.performance.getEntriesByName(`${name}_start`),
|
||||
window.performance.getEntriesByName(`${name}_end`)
|
||||
).map(([start, end]) => +(end.startTime - start.startTime).toPrecision(2));
|
||||
}
|
||||
|
||||
function getTimes(name) {
|
||||
return window.performance
|
||||
.getEntriesByName(name)
|
||||
.map(time => +time.duration.toPrecision(2));
|
||||
}
|
||||
|
||||
function getStats(times) {
|
||||
if (times.length == 0) {
|
||||
return { times: [], avg: null, median: null };
|
||||
}
|
||||
const avg = times.reduce((sum, time) => time + sum, 0) / times.length;
|
||||
const sortedtimings = [...times].sort((a, b) => a - b);
|
||||
const median = sortedtimings[times.length / 2];
|
||||
return {
|
||||
times,
|
||||
avg: +avg.toPrecision(2),
|
||||
median: +median.toPrecision(2),
|
||||
};
|
||||
}
|
||||
|
||||
export function steppingTimings() {
|
||||
const commandTimings = getAsyncTimes("COMMAND");
|
||||
const pausedTimings = getTimes("PAUSED");
|
||||
|
||||
return {
|
||||
commands: getStats(commandTimings),
|
||||
paused: getStats(pausedTimings),
|
||||
};
|
||||
}
|
||||
|
||||
// console.log("..", asyncTimes("COMMAND"));
|
Loading…
Reference in New Issue
Block a user