mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
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',
|
||
|
});
|