Open this example in the interactive library
Source code
import {
performance,
createHistogram,
PerformanceObserver,
} from "node:perf_hooks";
console.log(performance.measure("phase", { start: 3, end: 8 }).duration);
Sample output
5

Open this example in the interactive library
import {
performance,
createHistogram,
PerformanceObserver,
} from "node:perf_hooks";
console.log(performance.measure("phase", { start: 3, end: 8 }).duration);
5