Perf Hooks

The performance object provides access to high-resolution timing.

Module: node:perf_hooks Support: Experimental Since: 1.1.0 Docs: Node.js Docs

10 members: 6 supported, 4 undocumented

Static Methods

🟢 now()
Returns the current high-resolution millisecond timestamp relative to timeOrigin.
⚪ mark(name, options)
The name of the performance entry. @compat elide Full
⚪ measure(name, startMarkOrOptions, endMark)
The name of the performance entry. @compat elide Full
🟢 getEntries()
Supported
🟢 getEntriesByName(name, type)
Supported
🟢 getEntriesByType(type)
Supported
🟢 clearMarks(name)
Removes all marks, or only marks with the given name.
🟢 clearMeasures(name)
Removes all measures, or only measures with the given name.

Properties

⚪ timeOrigin
The high-resolution millisecond timestamp at which the process started. @compat elide Full
⚪ nodeTiming
Timing information about the Node.js process lifecycle. @compat elide Full

Interface PerformanceEntry

A single performance entry (mark or measure).

Since: 1.1.0 Docs: Node.js Docs

6 members: 1 supported, 5 undocumented

Methods

⚪ toJSON()
Returns a JSON representation of this entry. @compat elide Full

Properties

🟢 name
A single performance entry (mark or measure).
⚪ entryType
The type of the entry: "mark", "measure", "node", "function", etc. @compat elide Full
⚪ startTime
The high-resolution timestamp when the entry was created. @compat elide Full
⚪ duration
The high-resolution timestamp when the entry was created. @compat elide Full
⚪ detail
The duration of the entry in milliseconds (0 for marks). @compat elide Full

---

Interface PerformanceMark

A user-defined performance mark created via performance.mark().

Extends: PerformanceEntry Since: 1.1.0 Docs: Node.js Docs

Constructors

🟢 constructor(markName, options)
Supported

---

Interface PerformanceMeasure

A user-defined performance measure created via performance.measure().

Extends: PerformanceEntry Since: 1.1.0 Docs: Node.js Docs

---

Interface PerformanceNodeTiming

Timing information about the Node.js process itself.

Extends: PerformanceEntry Since: 1.1.0 Docs: Node.js Docs

7 members: 7 undocumented

Properties

⚪ nodeStart
Timestamp when the Node.js process completed bootstrapping. @compat elide Full
⚪ v8Start
Timestamp when the V8 platform was initialized. @compat elide Full
⚪ environment
Timestamp when the V8 platform was initialized. @compat elide Full
⚪ bootstrapComplete
Timestamp when bootstrapping of the main module completed. @compat elide Full
⚪ loopStart
Timestamp when the Node.js event loop started. @compat elide Full
⚪ loopExit
Timestamp when the Node.js event loop exited. @compat elide Full
⚪ idleTime
Cumulative idle time of the event loop in milliseconds. @compat elide Full

---

Interface PerformanceObserverEntryList

Provides a read-only list of PerformanceEntry objects delivered to an observer callback.

Since: 1.1.0 Docs: Node.js Docs

Methods

🟢 getEntries()
Supported
🟢 getEntriesByName(name, type)
Supported
🟢 getEntriesByType(type)
Supported

---

Interface PerformanceObserver

Observes performance entry notifications and delivers them asynchronously via callback.

Since: 1.1.0 Docs: Node.js Docs

5 members: 3 supported, 2 undocumented

Constructors

🟢 constructor(callback)
Supported

Methods

🟢 observe(options)
Start observing performance entries matching the given options.
⚪ disconnect()
Stop observing and discard any pending entries. @compat elide Full
🟢 takeRecords()
Supported

Properties

⚪ supportedEntryTypes
A frozen array of entry type strings supported by the implementation. @compat elide Full

---

Details

observe(options)

observe(options?: object)

observe(options?: object)

Start observing performance entries matching the given options.
ParameterTypeDescription
options (optional)objectMust contain either entryTypes (array) or type (string), not both.
Throws:
  • TypeError --- If both entryTypes and type are present, or neither is.
  • DOMException --- InvalidModificationError if switching between entryTypes and type modes.

---

Callback PerformanceObserverCallback

---