Skip to main content
Performance.measure - perf_hooks - Node documentation
method Performance.measure

Usage in Deno

import { type Performance } from "node:perf_hooks";
Performance.measure(
name: string,
startMark?: string,
endMark?: string,
): PerformanceMeasure

Creates a new PerformanceMeasure entry in the Performance Timeline. A PerformanceMeasure is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'measure', and whose performanceEntry.duration measures the number of milliseconds elapsed since startMark and endMark.

The startMark argument may identify any existing PerformanceMark in the the Performance Timeline, or may identify any of the timestamp properties provided by the PerformanceNodeTiming class. If the named startMark does not exist, then startMark is set to timeOrigin by default.

The endMark argument must identify any existing PerformanceMark in the the Performance Timeline or any of the timestamp properties provided by the PerformanceNodeTiming class. If the named endMark does not exist, an error will be thrown.

Parameters

name: string
optional
startMark: string
optional
endMark: string

Return Type

The PerformanceMeasure entry that was created

Performance.measure(
name: string,
options: MeasureOptions,
): PerformanceMeasure

Parameters

name: string
options: MeasureOptions

Return Type