Skip to content

Commit

Permalink
benchmark: add nodeTiming.uvmetricsinfo bench
Browse files Browse the repository at this point in the history
PR-URL: nodejs#55614
Reviewed-By: Juan José Arboleda <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Stephen Belanger <[email protected]>
Reviewed-By: Vinícius Lourenço Claro Cardoso <[email protected]>
  • Loading branch information
RafaelGSS authored and tpoisseau committed Nov 21, 2024
1 parent 7907f33 commit 5c365bf
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions benchmark/perf_hooks/nodetiming-uvmetricsinfo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
'use strict';

const common = require('../common.js');
const assert = require('node:assert');
const fs = require('node:fs/promises');

const {
performance,
} = require('perf_hooks');

const bench = common.createBenchmark(main, {
n: [1e6],
events: [1, 1000, 10000],
});

async function runEvents(events) {
for (let i = 0; i < events; ++i) {
assert.ok(await fs.statfs(__filename));
}
}

async function main({ n, events }) {
await runEvents(events);
bench.start();
for (let i = 0; i < n; i++) {
assert.ok(performance.nodeTiming.uvMetricsInfo);
}
bench.end(n);
}

0 comments on commit 5c365bf

Please sign in to comment.