node/lib/perf_hooks.js
Chengzhong Wu 798a6edddf
perf_hooks: add resourcetiming buffer limit
Add WebPerf API `performance.setResourceTimingBufferSize` and event
`'resourcetimingbufferfull'` support.

The resource timing entries are added to the global performance
timeline buffer automatically when using fetch. If users are not
proactively cleaning these events, it can grow without limit. Apply
the https://www.w3.org/TR/timing-entrytypes-registry/ default
resource timing buffer max size so that the buffer can be limited
to not grow indefinitely.

PR-URL: https://github.com/nodejs/node/pull/44220
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2022-08-21 10:43:39 +08:00

51 lines
1.0 KiB
JavaScript

'use strict';
const {
ObjectDefineProperty,
} = primordials;
const {
constants,
} = internalBinding('performance');
const { PerformanceEntry } = require('internal/perf/performance_entry');
const { PerformanceResourceTiming } = require('internal/perf/resource_timing');
const {
PerformanceObserver,
PerformanceObserverEntryList,
} = require('internal/perf/observe');
const {
PerformanceMark,
PerformanceMeasure,
} = require('internal/perf/usertiming');
const {
Performance,
performance,
} = require('internal/perf/performance');
const {
createHistogram
} = require('internal/histogram');
const monitorEventLoopDelay = require('internal/perf/event_loop_delay');
module.exports = {
Performance,
PerformanceEntry,
PerformanceMark,
PerformanceMeasure,
PerformanceObserver,
PerformanceObserverEntryList,
PerformanceResourceTiming,
monitorEventLoopDelay,
createHistogram,
performance,
};
ObjectDefineProperty(module.exports, 'constants', {
__proto__: null,
configurable: false,
enumerable: true,
value: constants
});