-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib: add toJSON to PerformanceMeasure
PR-URL: #53603 Refs: #53570 Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Chemi Atlow <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
- Loading branch information
1 parent
460240c
commit 1e9ff50
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'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', | ||
}); |