0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-24 03:07:54 +01:00

benchmark: add nodeTiming.uvmetricsinfo bench

PR-URL: https://github.com/nodejs/node/pull/55614
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
This commit is contained in:
RafaelGSS 2024-10-30 22:58:06 -03:00
parent 2d6f9c613c
commit d83e9faf2c

View File

@ -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);
}