| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 88babd5 commit 6bdfb1f
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,6 +29,14 @@ added: v8.5.0 | |||
| 29 | 29 | The `Performance` provides access to performance metric data. A single | |
| 30 | 30 | instance of this class is provided via the `performance` property. | |
| 31 | 31 | ||
| 32 | + ### performance.clearEntries(name) | ||
| 33 | + <!-- YAML | ||
| 34 | + added: REPLACEME | ||
| 35 | + --> | ||
| 36 | + | ||
| 37 | + Remove all performance entry objects with `entryType` equal to `name` from the | ||
| 38 | + Performance Timeline. | ||
| 39 | + | ||
| 32 | 40 | ### performance.clearFunctions([name]) | |
| 33 | 41 | <!-- YAML | |
| 34 | 42 | added: v8.5.0 | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -471,6 +471,10 @@ class Performance extends PerformanceObserverEntryList { | |||
| 471 | 471 | this[kClearEntry]('function', name); | |
| 472 | 472 | } | |
| 473 | 473 | ||
| 474 | + clearEntries(name) { | ||
| 475 | + this[kClearEntry](name); | ||
| 476 | + } | ||
| 477 | + | ||
| 474 | 478 | timerify(fn) { | |
| 475 | 479 | if (typeof fn !== 'function') { | |
| 476 | 480 | const errors = lazyErrors(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,7 +6,7 @@ if (!common.hasCrypto) | |||
| 6 | 6 | const assert = require('assert'); | |
| 7 | 7 | const h2 = require('http2'); | |
| 8 | 8 | ||
| 9 | - const { PerformanceObserver } = require('perf_hooks'); | ||
| 9 | + const { PerformanceObserver, performance } = require('perf_hooks'); | ||
| 10 | 10 | ||
| 11 | 11 | const obs = new PerformanceObserver(common.mustCall((items) => { | |
| 12 | 12 | const entry = items.getEntries()[0]; | |
@@ -46,6 +46,7 @@ const obs = new PerformanceObserver(common.mustCall((items) => { | |||
| 46 | 46 | default: | |
| 47 | 47 | assert.fail('invalid entry name'); | |
| 48 | 48 | } | |
| 49 | + performance.clearEntries('http2'); | ||
| 49 | 50 | }, 4)); | |
| 50 | 51 | obs.observe({ entryTypes: ['http2'] }); | |
| 51 | 52 | ||
@@ -100,3 +101,10 @@ server.on('listening', common.mustCall(() => { | |||
| 100 | 101 | })); | |
| 101 | 102 | ||
| 102 | 103 | })); | |
| 104 | + | ||
| 105 | + process.on('exit', () => { | ||
| 106 | + const entries = performance.getEntries(); | ||
| 107 | + // There shouldn't be any http2 entries left over. | ||
| 108 | + assert.strictEqual(entries.length, 1); | ||
| 109 | + assert.strictEqual(entries[0], performance.nodeTiming); | ||
| 110 | + }); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments