-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf_hooks: add warning when too many entries in the timeline
PR-URL: #18087 Reviewed-By: Matteo Collina <[email protected]>
- Loading branch information
1 parent
a07cd06
commit 0a47b98
Showing
3 changed files
with
88 additions
and
4 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
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,29 @@ | ||
// Flags: --no-warnings | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
const { performance } = require('perf_hooks'); | ||
const assert = require('assert'); | ||
|
||
assert.strictEqual(performance.length, 1); | ||
assert.strictEqual(performance.maxEntries, 150); | ||
|
||
performance.maxEntries = 1; | ||
|
||
[-1, 0xffffffff + 1, '', null, undefined, Infinity].forEach((i) => { | ||
common.expectsError( | ||
() => performance.maxEntries = i, | ||
{ | ||
code: 'ERR_INVALID_ARG_TYPE', | ||
type: TypeError | ||
} | ||
); | ||
}); | ||
|
||
common.expectWarning('Warning', [ | ||
'Possible perf_hooks memory leak detected. There are 2 entries in the ' + | ||
'Performance Timeline. Use the clear methods to remove entries that are no ' + | ||
'longer needed or set performance.maxEntries equal to a higher value ' + | ||
'(currently the maxEntries is 1).']); | ||
|
||
performance.mark('test'); |