mirror of
https://github.com/denoland/deno.git
synced 2025-09-21 18:10:02 +00:00

Adding back a sham for "perf_hooks.markResourceTiming" that was removed by accident in https://github.com/denoland/deno/pull/29323; a test was added too, to ensure it doesn't regress in the future. Closes https://github.com/denoland/deno/issues/29539
56 lines
1.3 KiB
JavaScript
56 lines
1.3 KiB
JavaScript
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
|
|
// TODO(petamoriken): enable prefer-primordials for node polyfills
|
|
// deno-lint-ignore-file prefer-primordials
|
|
|
|
import { notImplemented } from "ext:deno_node/_utils.ts";
|
|
import { performance, PerformanceEntry } from "ext:deno_web/15_performance.js";
|
|
import { EldHistogram } from "ext:core/ops";
|
|
|
|
class PerformanceObserver {
|
|
static supportedEntryTypes = [];
|
|
observe() {
|
|
// todo(lucacasonato): actually implement this
|
|
}
|
|
disconnect() {
|
|
// todo(lucacasonato): actually implement this
|
|
}
|
|
}
|
|
|
|
const constants = {};
|
|
|
|
performance.eventLoopUtilization = () => {
|
|
// TODO(@marvinhagemeister): Return actual non-stubbed values
|
|
return { idle: 0, active: 0, utilization: 0 };
|
|
};
|
|
|
|
// TODO(bartlomieju):
|
|
performance.nodeTiming = {};
|
|
|
|
// TODO(bartlomieju):
|
|
performance.timerify = () => notImplemented("timerify from performance");
|
|
|
|
// TODO(bartlomieju):
|
|
performance.markResourceTiming = () => {};
|
|
|
|
function monitorEventLoopDelay(options = {}) {
|
|
const { resolution = 10 } = options;
|
|
|
|
return new EldHistogram(resolution);
|
|
}
|
|
|
|
export default {
|
|
performance,
|
|
PerformanceObserver,
|
|
PerformanceEntry,
|
|
monitorEventLoopDelay,
|
|
constants,
|
|
};
|
|
|
|
export {
|
|
constants,
|
|
monitorEventLoopDelay,
|
|
performance,
|
|
PerformanceEntry,
|
|
PerformanceObserver,
|
|
};
|