An object that can be used to collect performance metrics from the current Node.js instance.
It is similar to window.performance in browsers.
Extends EventTarget (not EventEmitter).
See also:
Variables
read onlynodeTiming:PerformanceNodeTiming
An instance of the PerformanceNodeTiming class that provides performance metrics for
specific Node.js operational milestones.
This property is an extension by Node.js. It is not available in Web browsers.
onresourcetimingbufferfull:EitherType<Event ‑> Void, Function>
Event handler for the 'resourcetimingbufferfull' event.
read onlytimeOrigin:Float
The timeOrigin specifies the high resolution millisecond timestamp at which the current
node process began, measured in Unix time.
Methods
clearMarks(?name:String):Void
If name is not provided, removes all PerformanceMark objects from the Performance Timeline.
If name is provided, removes only the named mark.
clearMeasures(?name:String):Void
If name is not provided, removes all PerformanceMeasure objects from the Performance Timeline.
If name is provided, removes only the named measure.
clearResourceTimings(?name:String):Void
If name is not provided, removes all PerformanceResourceTiming objects from the Resource Timeline.
If name is provided, removes only the named resource.
eventLoopUtilization(?utilization1:EventLoopUtilization, ?utilization2:EventLoopUtilization):EventLoopUtilization
Returns an object that contains the cumulative duration of time the event loop has been both idle and active as a high resolution milliseconds timer.
This property is an extension by Node.js. It is not available in Web browsers.
Prefer this over the module-level PerfHooks.eventLoopUtilization when targeting
Node.js 22 LTS as well as Node.js 24; the module-level alias was only added in v24.12.0.
getEntries():Array<PerformanceEntry>
Returns a list of PerformanceEntry objects in chronological order with respect to
performanceEntry.startTime.
getEntriesByName(name:String, ?type:PerformanceEntryType):Array<PerformanceEntry>
Returns a list of PerformanceEntry objects in chronological order with respect to
performanceEntry.startTime whose performanceEntry.name is equal to name, and optionally,
whose performanceEntry.entryType is equal to type.
getEntriesByType(type:PerformanceEntryType):Array<PerformanceEntry>
Returns a list of PerformanceEntry objects in chronological order with respect to
performanceEntry.startTime whose performanceEntry.entryType is equal to type.
mark(name:String, ?options:PerformanceMarkOptions):PerformanceMark
Creates a new PerformanceMark entry in the Performance Timeline.
markResourceTiming(timingInfo:Dynamic, requestedUrl:String, initiatorType:String, global:Dynamic, cacheMode:String, bodyInfo:Dynamic, responseStatus:Int, ?deliveryType:String):PerformanceResourceTiming
Creates a new PerformanceResourceTiming entry in the Resource Timeline.
This property is an extension by Node.js. It is not available in Web browsers.
measure(name:String, ?startMark:String, ?endMark:String):PerformanceMeasure
measure(name:String, options:PerformanceMeasureOptions):PerformanceMeasure
Creates a new PerformanceMeasure entry in the Performance Timeline.
now():Float
Returns the current high resolution millisecond timestamp, where 0 represents the start
of the current node process.
setResourceTimingBufferSize(maxSize:Int):Void
Sets the global performance resource timing buffer size to the specified number of "resource" type performance entry objects.
By default the max buffer size is set to 250.
timerify<T>(fn:T, ?options:TimerifyOptions):T
Wraps a function within a new function that measures the running time of the wrapped function.
A PerformanceObserver must be subscribed to the 'function' event type in order for the
timing details to be accessed.
This property is an extension by Node.js. It is not available in Web browsers.
Prefer this over the module-level PerfHooks.timerify when targeting Node.js 22 LTS as well
as Node.js 24; the module-level alias was only added in v24.12.0.