mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
77710251e1
PR-URL: https://github.com/nodejs/node/pull/53603 Refs: https://github.com/nodejs/node/issues/53570 Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
21 lines
554 B
JavaScript
21 lines
554 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const util = require('util');
|
|
const { performance, PerformanceObserver } = require('perf_hooks');
|
|
|
|
const perfObserver = new PerformanceObserver(common.mustCall((items) => {
|
|
const entries = items.getEntries();
|
|
assert.ok(entries.length === 1);
|
|
for (const entry of entries) {
|
|
assert.ok(util.inspect(entry).includes('this is detail'));
|
|
}
|
|
}));
|
|
|
|
perfObserver.observe({ entryTypes: ['measure'] });
|
|
|
|
performance.measure('sample', {
|
|
detail: 'this is detail',
|
|
});
|