{"$schema":"https://doc-kit.nodejs.org/schemas/api-doc/1.0.0.json","id":"perf_hooks","path":"/perf_hooks","type":"module","module":"perf_hooks","title":"Performance measurement APIs","introducedIn":"v8.5.0","sourceLink":{"path":"lib/perf_hooks.js","url":"https://github.com/nodejs/node/blob/HEAD/lib/perf_hooks.js"},"stability":{"index":"2","description":"Stable"},"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"This module provides an implementation of a subset of the W3C\n[Web Performance APIs](https://w3c.github.io/perf-timing-primer/) as well as additional APIs for\nNode.js-specific performance measurements.\n\nNode.js supports the following [Web Performance APIs](https://w3c.github.io/perf-timing-primer/):\n\n* [High Resolution Time](https://www.w3.org/TR/hr-time-2)\n* [Performance Timeline](https://w3c.github.io/performance-timeline/)\n* [User Timing](https://www.w3.org/TR/user-timing/)\n* [Resource Timing](https://www.w3.org/TR/resource-timing-2/)\n\n```mjs\nimport { performance, PerformanceObserver } from 'node:perf_hooks';\n\nconst obs = new PerformanceObserver((items) => {\n  console.log(items.getEntries()[0].duration);\n  performance.clearMarks();\n});\nobs.observe({ type: 'measure' });\nperformance.measure('Start to Now');\n\nperformance.mark('A');\ndoSomeLongRunningProcess(() => {\n  performance.measure('A to Now', 'A');\n\n  performance.mark('B');\n  performance.measure('A to B', 'A', 'B');\n});\n```\n\n```cjs\nconst { PerformanceObserver, performance } = require('node:perf_hooks');\n\nconst obs = new PerformanceObserver((items) => {\n  console.log(items.getEntries()[0].duration);\n});\nobs.observe({ type: 'measure' });\nperformance.measure('Start to Now');\n\nperformance.mark('A');\n(async function doSomeLongRunningProcess() {\n  await new Promise((r) => setTimeout(r, 5000));\n  performance.measure('A to Now', 'A');\n\n  performance.mark('B');\n  performance.measure('A to B', 'A', 'B');\n})();\n```","summary":"This module provides an implementation of a subset of the W3C Web Performance APIs as well as additional APIs for Node.js-specific performance measurements.","examples":[{"language":"mjs","displayName":null,"code":"import { performance, PerformanceObserver } from 'node:perf_hooks';\n\nconst obs = new PerformanceObserver((items) => {\n  console.log(items.getEntries()[0].duration);\n  performance.clearMarks();\n});\nobs.observe({ type: 'measure' });\nperformance.measure('Start to Now');\n\nperformance.mark('A');\ndoSomeLongRunningProcess(() => {\n  performance.measure('A to Now', 'A');\n\n  performance.mark('B');\n  performance.measure('A to B', 'A', 'B');\n});"},{"language":"cjs","displayName":null,"code":"const { PerformanceObserver, performance } = require('node:perf_hooks');\n\nconst obs = new PerformanceObserver((items) => {\n  console.log(items.getEntries()[0].duration);\n});\nobs.observe({ type: 'measure' });\nperformance.measure('Start to Now');\n\nperformance.mark('A');\n(async function doSomeLongRunningProcess() {\n  await new Promise((r) => setTimeout(r, 5000));\n  performance.measure('A to Now', 'A');\n\n  performance.mark('B');\n  performance.measure('A to B', 'A', 'B');\n})();"}],"children":[{"kind":"property","id":"perf_hooksperformance","name":"performance","title":"`perf_hooks.performance`","scope":"module","overloadOf":null,"stability":null,"added":["v8.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":null,"default":null,"description":"An object that can be used to collect performance metrics from the current\nNode.js instance. It is similar to [`window.performance`](https://developer.mozilla.org/en-US/docs/Web/API/Window/performance) in browsers.","summary":"An object that can be used to collect performance metrics from the current Node.js instance. It is similar to `window.performance` in browsers.","examples":[],"children":[{"kind":"method","id":"performanceclearmarksname","name":"clearMarks","title":"`performance.clearMarks([name])`","scope":"module","overloadOf":null,"stability":null,"added":["v8.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v19.0.0"],"prUrl":"https://github.com/nodejs/node/pull/44483","commit":null,"description":"This method must be called with the `performance` object as the receiver."}],"signature":{"parameters":[{"name":"name","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"If `name` is not provided, removes all `PerformanceMark` objects from the\nPerformance Timeline. If `name` is provided, removes only the named mark.","summary":"If `name` is not provided, removes all `PerformanceMark` objects from the Performance Timeline. If `name` is provided, removes only the named mark.","examples":[],"children":[]},{"kind":"method","id":"performanceclearmeasuresname","name":"clearMeasures","title":"`performance.clearMeasures([name])`","scope":"module","overloadOf":null,"stability":null,"added":["v16.7.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v19.0.0"],"prUrl":"https://github.com/nodejs/node/pull/44483","commit":null,"description":"This method must be called with the `performance` object as the receiver."}],"signature":{"parameters":[{"name":"name","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"If `name` is not provided, removes all `PerformanceMeasure` objects from the\nPerformance Timeline. If `name` is provided, removes only the named measure.","summary":"If `name` is not provided, removes all `PerformanceMeasure` objects from the Performance Timeline. If `name` is provided, removes only the named measure.","examples":[],"children":[]},{"kind":"method","id":"performanceclearresourcetimingsname","name":"clearResourceTimings","title":"`performance.clearResourceTimings([name])`","scope":"module","overloadOf":null,"stability":null,"added":["v18.2.0","v16.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v19.0.0"],"prUrl":"https://github.com/nodejs/node/pull/44483","commit":null,"description":"This method must be called with the `performance` object as the receiver."}],"signature":{"parameters":[{"name":"name","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"If `name` is not provided, removes all `PerformanceResourceTiming` objects from\nthe Resource Timeline. If `name` is provided, removes only the named resource.","summary":"If `name` is not provided, removes all `PerformanceResourceTiming` objects from the Resource Timeline. If `name` is provided, removes only the named resource.","examples":[],"children":[]},{"kind":"method","id":"performanceeventlooputilizationutilization1-utilization2","name":"eventLoopUtilization","title":"`performance.eventLoopUtilization([utilization1[, utilization2]])`","scope":"module","overloadOf":null,"stability":null,"added":["v14.10.0","v12.19.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v25.2.0","v24.12.0"],"prUrl":"https://github.com/nodejs/node/pull/60370","commit":null,"description":"Added `perf_hooks.eventLoopUtilization` alias."}],"signature":{"parameters":[{"name":"utilization1","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"The result of a previous call to\n`eventLoopUtilization()`.","default":null,"optional":true,"rest":false,"properties":[]},{"name":"utilization2","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"The result of a previous call to\n`eventLoopUtilization()` prior to `utilization1`.","default":null,"optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":""}},"description":"This is an alias of [`perf_hooks.eventLoopUtilization()`](#perf_hookseventlooputilizationutilization1-utilization2).\n\n*This property is an extension by Node.js. It is not available in Web browsers.*","summary":"This is an alias of `perf_hooks.eventLoopUtilization()`.","examples":[],"children":[]},{"kind":"method","id":"performancegetentries","name":"getEntries","title":"`performance.getEntries()`","scope":"module","overloadOf":null,"stability":null,"added":["v16.7.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v19.0.0"],"prUrl":"https://github.com/nodejs/node/pull/44483","commit":null,"description":"This method must be called with the `performance` object as the receiver."}],"signature":{"parameters":[],"returns":{"type":{"text":"PerformanceEntry[]","links":[{"name":"PerformanceEntry","href":"perf_hooks.html#class-performanceentry","start":0,"end":16}]},"description":""}},"description":"Returns a list of `PerformanceEntry` objects in chronological order with\nrespect to `performanceEntry.startTime`. If you are only interested in\nperformance entries of certain types or that have certain names, see\n`performance.getEntriesByType()` and `performance.getEntriesByName()`.","summary":"Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`. If you are only interested in performance entries of certain types or that have certain names, see `performance.getEntriesByType()` and `performance.getEntriesByName()`.","examples":[],"children":[]},{"kind":"method","id":"performancegetentriesbynamename-type","name":"getEntriesByName","title":"`performance.getEntriesByName(name[, type])`","scope":"module","overloadOf":null,"stability":null,"added":["v16.7.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v19.0.0"],"prUrl":"https://github.com/nodejs/node/pull/44483","commit":null,"description":"This method must be called with the `performance` object as the receiver."}],"signature":{"parameters":[{"name":"name","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"type","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"PerformanceEntry[]","links":[{"name":"PerformanceEntry","href":"perf_hooks.html#class-performanceentry","start":0,"end":16}]},"description":""}},"description":"Returns a list of `PerformanceEntry` objects in chronological order\nwith respect to `performanceEntry.startTime` whose `performanceEntry.name` is\nequal to `name`, and optionally, whose `performanceEntry.entryType` is equal to\n`type`.","summary":"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`.","examples":[],"children":[]},{"kind":"method","id":"performancegetentriesbytypetype","name":"getEntriesByType","title":"`performance.getEntriesByType(type)`","scope":"module","overloadOf":null,"stability":null,"added":["v16.7.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v19.0.0"],"prUrl":"https://github.com/nodejs/node/pull/44483","commit":null,"description":"This method must be called with the `performance` object as the receiver."}],"signature":{"parameters":[{"name":"type","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"PerformanceEntry[]","links":[{"name":"PerformanceEntry","href":"perf_hooks.html#class-performanceentry","start":0,"end":16}]},"description":""}},"description":"Returns a list of `PerformanceEntry` objects in chronological order\nwith respect to `performanceEntry.startTime` whose `performanceEntry.entryType`\nis equal to `type`.","summary":"Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime` whose `performanceEntry.entryType` is equal to `type`.","examples":[],"children":[]},{"kind":"method","id":"performancemarkname-options","name":"mark","title":"`performance.mark(name[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v8.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v19.0.0"],"prUrl":"https://github.com/nodejs/node/pull/44483","commit":null,"description":"This method must be called with the `performance` object as the receiver. The name argument is no longer optional."},{"versions":["v16.0.0"],"prUrl":"https://github.com/nodejs/node/pull/37136","commit":null,"description":"Updated to conform to the User Timing Level 3 specification."}],"signature":{"parameters":[{"name":"name","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"detail","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"Additional optional detail to include with the mark.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"startTime","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"An optional timestamp to be used as the mark time.\n**Default**: `performance.now()`.","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":null},"description":"Creates a new `PerformanceMark` entry in the Performance Timeline. A\n`PerformanceMark` is a subclass of `PerformanceEntry` whose\n`performanceEntry.entryType` is always `'mark'`, and whose\n`performanceEntry.duration` is always `0`. Performance marks are used\nto mark specific significant moments in the Performance Timeline.\n\nThe created `PerformanceMark` entry is put in the global Performance Timeline\nand can be queried with `performance.getEntries`,\n`performance.getEntriesByName`, and `performance.getEntriesByType`. When the\nobservation is performed, the entries should be cleared from the global\nPerformance Timeline manually with `performance.clearMarks`.","summary":"Creates a new `PerformanceMark` entry in the Performance Timeline. A `PerformanceMark` is a subclass of `PerformanceEntry` whose `performanceEntry.entryType` is always `'mark'`, and whose `performanceEntry.duration` is always `0`. Performance marks are used to mark specific significant moments in the Performance Timeline.","examples":[],"children":[]},{"kind":"method","id":"performancemarkresourcetimingtiminginfo-requestedurl-initiatortype-global-cachemode-bodyinfo-responsestatus-deliverytype","name":"markResourceTiming","title":"`performance.markResourceTiming(timingInfo, requestedUrl, initiatorType, global, cacheMode, bodyInfo, responseStatus[, deliveryType])`","scope":"module","overloadOf":null,"stability":null,"added":["v18.2.0","v16.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v22.2.0"],"prUrl":"https://github.com/nodejs/node/pull/51589","commit":null,"description":"Added bodyInfo, responseStatus, and deliveryType arguments."}],"signature":{"parameters":[{"name":"timingInfo","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"[Fetch Timing Info](https://fetch.spec.whatwg.org/#fetch-timing-info)","default":null,"optional":false,"rest":false,"properties":[]},{"name":"requestedUrl","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The resource url","default":null,"optional":false,"rest":false,"properties":[]},{"name":"initiatorType","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The initiator name, e.g: 'fetch'","default":null,"optional":false,"rest":false,"properties":[]},{"name":"global","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"cacheMode","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The cache mode must be an empty string ('') or 'local'","default":null,"optional":false,"rest":false,"properties":[]},{"name":"bodyInfo","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"[Fetch Response Body Info](https://fetch.spec.whatwg.org/#response-body-info)","default":null,"optional":false,"rest":false,"properties":[]},{"name":"responseStatus","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"The response's status code","default":null,"optional":false,"rest":false,"properties":[]},{"name":"deliveryType","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The delivery type.","default":"''","optional":true,"rest":false,"properties":[]}],"returns":null},"description":"*This property is an extension by Node.js. It is not available in Web browsers.*\n\nCreates a new `PerformanceResourceTiming` entry in the Resource Timeline. A\n`PerformanceResourceTiming` is a subclass of `PerformanceEntry` whose\n`performanceEntry.entryType` is always `'resource'`. Performance resources\nare used to mark moments in the Resource Timeline.\n\nThe created `PerformanceMark` entry is put in the global Resource Timeline\nand can be queried with `performance.getEntries`,\n`performance.getEntriesByName`, and `performance.getEntriesByType`. When the\nobservation is performed, the entries should be cleared from the global\nPerformance Timeline manually with `performance.clearResourceTimings`.","summary":"_This property is an extension by Node.js. It is not available in Web browsers._","examples":[],"children":[]},{"kind":"method","id":"performancemeasurename-startmarkoroptions-endmark","name":"measure","title":"`performance.measure(name[, startMarkOrOptions[, endMark]])`","scope":"module","overloadOf":null,"stability":null,"added":["v8.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v19.0.0"],"prUrl":"https://github.com/nodejs/node/pull/44483","commit":null,"description":"This method must be called with the `performance` object as the receiver."},{"versions":["v16.0.0"],"prUrl":"https://github.com/nodejs/node/pull/37136","commit":null,"description":"Updated to conform to the User Timing Level 3 specification."},{"versions":["v13.13.0","v12.16.3"],"prUrl":"https://github.com/nodejs/node/pull/32651","commit":null,"description":"Make `startMark` and `endMark` parameters optional."}],"signature":{"parameters":[{"name":"name","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"startMarkOrOptions","type":{"text":"string | Object","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":9,"end":15}]},"description":"Optional.","default":null,"optional":true,"rest":false,"properties":[{"name":"detail","type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"description":"Additional optional detail to include with the measure.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"duration","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Duration between start and end times.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"end","type":{"text":"number | string","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":9,"end":15}]},"description":"Timestamp to be used as the end time, or a string\nidentifying a previously recorded mark.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"start","type":{"text":"number | string","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":9,"end":15}]},"description":"Timestamp to be used as the start time, or a string\nidentifying a previously recorded mark.","default":null,"optional":false,"rest":false,"properties":[]}]},{"name":"endMark","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"Optional. Must be omitted if `startMarkOrOptions` is an\n{Object}.","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Creates a new `PerformanceMeasure` entry in the Performance Timeline. A\n`PerformanceMeasure` is a subclass of `PerformanceEntry` whose\n`performanceEntry.entryType` is always `'measure'`, and whose\n`performanceEntry.duration` measures the number of milliseconds elapsed since\n`startMark` and `endMark`.\n\nThe `startMark` argument may identify any *existing* `PerformanceMark` in the\nPerformance Timeline, or *may* identify any of the timestamp properties\nprovided by the `PerformanceNodeTiming` class. If the named `startMark` does\nnot exist, an error is thrown.\n\nThe optional `endMark` argument must identify any *existing* `PerformanceMark`\nin the Performance Timeline or any of the timestamp properties provided by the\n`PerformanceNodeTiming` class. `endMark` will be `performance.now()`\nif no parameter is passed, otherwise if the named `endMark` does not exist, an\nerror will be thrown.\n\nThe created `PerformanceMeasure` entry is put in the global Performance Timeline\nand can be queried with `performance.getEntries`,\n`performance.getEntriesByName`, and `performance.getEntriesByType`. When the\nobservation is performed, the entries should be cleared from the global\nPerformance Timeline manually with `performance.clearMeasures`.","summary":"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`.","examples":[],"children":[]},{"kind":"property","id":"performancenodetiming","name":"nodeTiming","title":"`performance.nodeTiming`","scope":"module","overloadOf":null,"stability":null,"added":["v8.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"PerformanceNodeTiming","links":[{"name":"PerformanceNodeTiming","href":"perf_hooks.html#class-performancenodetiming","start":0,"end":21}]},"default":null,"description":"*This property is an extension by Node.js. It is not available in Web browsers.*\n\nAn instance of the `PerformanceNodeTiming` class that provides performance\nmetrics for specific Node.js operational milestones.","summary":"_This property is an extension by Node.js. It is not available in Web browsers._","examples":[],"children":[]},{"kind":"method","id":"performancenow","name":"now","title":"`performance.now()`","scope":"module","overloadOf":null,"stability":null,"added":["v8.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v19.0.0"],"prUrl":"https://github.com/nodejs/node/pull/44483","commit":null,"description":"This method must be called with the `performance` object as the receiver."}],"signature":{"parameters":[],"returns":{"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":""}},"description":"Returns the current high resolution millisecond timestamp, where 0 represents\nthe start of the current `node` process.","summary":"Returns the current high resolution millisecond timestamp, where 0 represents the start of the current `node` process.","examples":[],"children":[]},{"kind":"method","id":"performancesetresourcetimingbuffersizemaxsize","name":"setResourceTimingBufferSize","title":"`performance.setResourceTimingBufferSize(maxSize)`","scope":"module","overloadOf":null,"stability":null,"added":["v18.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v19.0.0"],"prUrl":"https://github.com/nodejs/node/pull/44483","commit":null,"description":"This method must be called with the `performance` object as the receiver."}],"signature":{"parameters":[{"name":"maxSize","type":null,"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"Sets the global performance resource timing buffer size to the specified number\nof \"resource\" type performance entry objects.\n\nBy default the max buffer size is set to 250.","summary":"Sets the global performance resource timing buffer size to the specified number of \"resource\" type performance entry objects.","examples":[],"children":[]},{"kind":"property","id":"performancetimeorigin","name":"timeOrigin","title":"`performance.timeOrigin`","scope":"module","overloadOf":null,"stability":null,"added":["v8.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The [`timeOrigin`](https://w3c.github.io/hr-time/#dom-performance-timeorigin) specifies the high resolution millisecond timestamp at\nwhich the current `node` process began, measured in Unix time.","summary":"The `timeOrigin` specifies the high resolution millisecond timestamp at which the current `node` process began, measured in Unix time.","examples":[],"children":[]},{"kind":"method","id":"performancetimerifyfn-options","name":"timerify","title":"`performance.timerify(fn[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v8.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v25.2.0","v24.12.0"],"prUrl":"https://github.com/nodejs/node/pull/60370","commit":null,"description":"Added `perf_hooks.timerify` alias."},{"versions":["v16.0.0"],"prUrl":"https://github.com/nodejs/node/pull/37475","commit":null,"description":"Added the histogram option."},{"versions":["v16.0.0"],"prUrl":"https://github.com/nodejs/node/pull/37136","commit":null,"description":"Re-implemented to use pure-JavaScript and the ability to time async functions."}],"signature":{"parameters":[{"name":"fn","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"histogram","type":{"text":"RecordableHistogram","links":[{"name":"RecordableHistogram","href":"perf_hooks.html#class-recordablehistogram-extends-histogram","start":0,"end":19}]},"description":"A histogram object created using\n`perf_hooks.createHistogram()` that will record runtime durations in\nnanoseconds.","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":null},"description":"This is an alias of [`perf_hooks.timerify()`](#perf_hookstimerifyfn-options).\n\n*This property is an extension by Node.js. It is not available in Web browsers.*","summary":"This is an alias of `perf_hooks.timerify()`.","examples":[],"children":[]},{"kind":"method","id":"performancetojson","name":"toJSON","title":"`performance.toJSON()`","scope":"module","overloadOf":null,"stability":null,"added":["v16.1.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v19.0.0"],"prUrl":"https://github.com/nodejs/node/pull/44483","commit":null,"description":"This method must be called with the `performance` object as the receiver."}],"signature":{"parameters":[],"returns":null},"description":"An object which is JSON representation of the `performance` object. It\nis similar to [`window.performance.toJSON`](https://developer.mozilla.org/en-US/docs/Web/API/Performance/toJSON) in browsers.","summary":"An object which is JSON representation of the `performance` object. It is similar to `window.performance.toJSON` in browsers.","examples":[],"children":[{"kind":"event","id":"event-resourcetimingbufferfull","name":"resourcetimingbufferfull","title":"Event: `'resourcetimingbufferfull'`","scope":"module","overloadOf":null,"stability":null,"added":["v18.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"parameters":[],"description":"The `'resourcetimingbufferfull'` event is fired when the global performance\nresource timing buffer is full. Adjust resource timing buffer size with\n`performance.setResourceTimingBufferSize()` or clear the buffer with\n`performance.clearResourceTimings()` in the event listener to allow\nmore entries to be added to the performance timeline buffer.","summary":"The `'resourcetimingbufferfull'` event is fired when the global performance resource timing buffer is full. Adjust resource timing buffer size with `performance.setResourceTimingBufferSize()` or clear the buffer with `performance.clearResourceTimings()` in the event listener to allow more entries to be added to the performance timeline buffer.","examples":[],"children":[]}]}]},{"kind":"class","id":"class-performanceentry","name":"PerformanceEntry","title":"Class: `PerformanceEntry`","scope":"module","overloadOf":null,"stability":null,"added":["v8.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":null,"description":"The constructor of this class is not exposed to users directly.","summary":"The constructor of this class is not exposed to users directly.","examples":[],"children":[{"kind":"property","id":"performanceentryduration","name":"duration","title":"`performanceEntry.duration`","scope":"module","overloadOf":null,"stability":null,"added":["v8.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v19.0.0"],"prUrl":"https://github.com/nodejs/node/pull/44483","commit":null,"description":"This property getter must be called with the `PerformanceEntry` object as the receiver."}],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The total number of milliseconds elapsed for this entry. This value will not\nbe meaningful for all Performance Entry types.","summary":"The total number of milliseconds elapsed for this entry. This value will not be meaningful for all Performance Entry types.","examples":[],"children":[]},{"kind":"property","id":"performanceentryentrytype","name":"entryType","title":"`performanceEntry.entryType`","scope":"module","overloadOf":null,"stability":null,"added":["v8.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v19.0.0"],"prUrl":"https://github.com/nodejs/node/pull/44483","commit":null,"description":"This property getter must be called with the `PerformanceEntry` object as the receiver."}],"type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"default":null,"description":"The type of the performance entry. It may be one of:\n\n* `'dns'` (Node.js only)\n* `'function'` (Node.js only)\n* `'gc'` (Node.js only)\n* `'http2'` (Node.js only)\n* `'http'` (Node.js only)\n* `'mark'` (available on the Web)\n* `'measure'` (available on the Web)\n* `'net'` (Node.js only)\n* `'node'` (Node.js only)\n* `'resource'` (available on the Web)","summary":"The type of the performance entry. It may be one of:","examples":[],"children":[]},{"kind":"property","id":"performanceentryname","name":"name","title":"`performanceEntry.name`","scope":"module","overloadOf":null,"stability":null,"added":["v8.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v19.0.0"],"prUrl":"https://github.com/nodejs/node/pull/44483","commit":null,"description":"This property getter must be called with the `PerformanceEntry` object as the receiver."}],"type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"default":null,"description":"The name of the performance entry.","summary":"The name of the performance entry.","examples":[],"children":[]},{"kind":"property","id":"performanceentrystarttime","name":"startTime","title":"`performanceEntry.startTime`","scope":"module","overloadOf":null,"stability":null,"added":["v8.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v19.0.0"],"prUrl":"https://github.com/nodejs/node/pull/44483","commit":null,"description":"This property getter must be called with the `PerformanceEntry` object as the receiver."}],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The high resolution millisecond timestamp marking the starting time of the\nPerformance Entry.","summary":"The high resolution millisecond timestamp marking the starting time of the Performance Entry.","examples":[],"children":[]}]},{"kind":"class","id":"class-performancemark","name":"PerformanceMark","title":"Class: `PerformanceMark`","scope":"module","overloadOf":null,"stability":null,"added":["v18.2.0","v16.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":{"text":"PerformanceEntry","links":[{"name":"PerformanceEntry","href":"perf_hooks.html#class-performanceentry","start":0,"end":16}]},"description":"Exposes marks created via the `Performance.mark()` method.","summary":"Exposes marks created via the `Performance.mark()` method.","examples":[],"children":[{"kind":"property","id":"performancemarkdetail","name":"detail","title":"`performanceMark.detail`","scope":"module","overloadOf":null,"stability":null,"added":["v16.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v19.0.0"],"prUrl":"https://github.com/nodejs/node/pull/44483","commit":null,"description":"This property getter must be called with the `PerformanceMark` object as the receiver."}],"type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"default":null,"description":"Additional detail specified when creating with `Performance.mark()` method.","summary":"Additional detail specified when creating with `Performance.mark()` method.","examples":[],"children":[]}]},{"kind":"class","id":"class-performancemeasure","name":"PerformanceMeasure","title":"Class: `PerformanceMeasure`","scope":"module","overloadOf":null,"stability":null,"added":["v18.2.0","v16.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":{"text":"PerformanceEntry","links":[{"name":"PerformanceEntry","href":"perf_hooks.html#class-performanceentry","start":0,"end":16}]},"description":"Exposes measures created via the `Performance.measure()` method.\n\nThe constructor of this class is not exposed to users directly.","summary":"Exposes measures created via the `Performance.measure()` method.","examples":[],"children":[{"kind":"property","id":"performancemeasuredetail","name":"detail","title":"`performanceMeasure.detail`","scope":"module","overloadOf":null,"stability":null,"added":["v16.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v19.0.0"],"prUrl":"https://github.com/nodejs/node/pull/44483","commit":null,"description":"This property getter must be called with the `PerformanceMeasure` object as the receiver."}],"type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"default":null,"description":"Additional detail specified when creating with `Performance.measure()` method.","summary":"Additional detail specified when creating with `Performance.measure()` method.","examples":[],"children":[]}]},{"kind":"class","id":"class-performancenodeentry","name":"PerformanceNodeEntry","title":"Class: `PerformanceNodeEntry`","scope":"module","overloadOf":null,"stability":null,"added":["v19.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":{"text":"PerformanceEntry","links":[{"name":"PerformanceEntry","href":"perf_hooks.html#class-performanceentry","start":0,"end":16}]},"description":"*This class is an extension by Node.js. It is not available in Web browsers.*\n\nProvides detailed Node.js timing data.\n\nThe constructor of this class is not exposed to users directly.","summary":"_This class is an extension by Node.js. It is not available in Web browsers._","examples":[],"children":[{"kind":"property","id":"performancenodeentrydetail","name":"detail","title":"`performanceNodeEntry.detail`","scope":"module","overloadOf":null,"stability":null,"added":["v16.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v19.0.0"],"prUrl":"https://github.com/nodejs/node/pull/44483","commit":null,"description":"This property getter must be called with the `PerformanceNodeEntry` object as the receiver."}],"type":{"text":"any","links":[{"name":"any","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Data_types","start":0,"end":3}]},"default":null,"description":"Additional detail specific to the `entryType`.","summary":"Additional detail specific to the `entryType`.","examples":[],"children":[]},{"kind":"property","id":"performancenodeentryflags","name":"flags","title":"`performanceNodeEntry.flags`","scope":"module","overloadOf":null,"stability":{"index":"0","description":"Deprecated: Use `performanceNodeEntry.detail` instead."},"added":["v13.9.0","v12.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v16.0.0"],"prUrl":"https://github.com/nodejs/node/pull/37136","commit":null,"description":"Runtime deprecated. Now moved to the detail property when entryType is 'gc'."}],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"When `performanceEntry.entryType` is equal to `'gc'`, the `performance.flags`\nproperty contains additional information about garbage collection operation.\nThe value may be one of:\n\n* `perf_hooks.constants.NODE_PERFORMANCE_GC_FLAGS_NO`\n* `perf_hooks.constants.NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED`\n* `perf_hooks.constants.NODE_PERFORMANCE_GC_FLAGS_FORCED`\n* `perf_hooks.constants.NODE_PERFORMANCE_GC_FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING`\n* `perf_hooks.constants.NODE_PERFORMANCE_GC_FLAGS_ALL_AVAILABLE_GARBAGE`\n* `perf_hooks.constants.NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY`\n* `perf_hooks.constants.NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE`","summary":"When `performanceEntry.entryType` is equal to `'gc'`, the `performance.flags` property contains additional information about garbage collection operation. The value may be one of:","examples":[],"children":[]},{"kind":"property","id":"performancenodeentrykind","name":"kind","title":"`performanceNodeEntry.kind`","scope":"module","overloadOf":null,"stability":{"index":"0","description":"Deprecated: Use `performanceNodeEntry.detail` instead."},"added":["v8.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v16.0.0"],"prUrl":"https://github.com/nodejs/node/pull/37136","commit":null,"description":"Runtime deprecated. Now moved to the detail property when entryType is 'gc'."}],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"When `performanceEntry.entryType` is equal to `'gc'`, the `performance.kind`\nproperty identifies the type of garbage collection operation that occurred.\nThe value may be one of:\n\n* `perf_hooks.constants.NODE_PERFORMANCE_GC_MAJOR`\n* `perf_hooks.constants.NODE_PERFORMANCE_GC_MINOR`\n* `perf_hooks.constants.NODE_PERFORMANCE_GC_MINOR_MARK_SWEEP`\n* `perf_hooks.constants.NODE_PERFORMANCE_GC_INCREMENTAL`\n* `perf_hooks.constants.NODE_PERFORMANCE_GC_WEAKCB`","summary":"When `performanceEntry.entryType` is equal to `'gc'`, the `performance.kind` property identifies the type of garbage collection operation that occurred. The value may be one of:","examples":[],"children":[]},{"kind":"section","id":"garbage-collection-gc-details","name":"Garbage Collection ('gc') Details","title":"Garbage Collection ('gc') Details","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"When `performanceEntry.type` is equal to `'gc'`, the\n`performanceNodeEntry.detail` property will be an {Object} with two properties:\n\n* `kind` {number} One of:\n  * `perf_hooks.constants.NODE_PERFORMANCE_GC_MAJOR`\n  * `perf_hooks.constants.NODE_PERFORMANCE_GC_MINOR`\n  * `perf_hooks.constants.NODE_PERFORMANCE_GC_MINOR_MARK_SWEEP`\n  * `perf_hooks.constants.NODE_PERFORMANCE_GC_INCREMENTAL`\n  * `perf_hooks.constants.NODE_PERFORMANCE_GC_WEAKCB`\n* `flags` {number} One of:\n  * `perf_hooks.constants.NODE_PERFORMANCE_GC_FLAGS_NO`\n  * `perf_hooks.constants.NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED`\n  * `perf_hooks.constants.NODE_PERFORMANCE_GC_FLAGS_FORCED`\n  * `perf_hooks.constants.NODE_PERFORMANCE_GC_FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING`\n  * `perf_hooks.constants.NODE_PERFORMANCE_GC_FLAGS_ALL_AVAILABLE_GARBAGE`\n  * `perf_hooks.constants.NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY`\n  * `perf_hooks.constants.NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE`","summary":"When `performanceEntry.type` is equal to `'gc'`, the `performanceNodeEntry.detail` property will be an {Object} with two properties:","examples":[],"children":[]},{"kind":"section","id":"http-http-details","name":"HTTP ('http') Details","title":"HTTP ('http') Details","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"When `performanceEntry.type` is equal to `'http'`, the\n`performanceNodeEntry.detail` property will be an {Object} containing\nadditional information.\n\nIf `performanceEntry.name` is equal to `HttpClient`, the `detail`\nwill contain the following properties: `req`, `res`. And the `req` property\nwill be an {Object} containing `method`, `url`, `headers`, the `res` property\nwill be an {Object} containing `statusCode`, `statusMessage`, `headers`.\n\nIf `performanceEntry.name` is equal to `HttpRequest`, the `detail`\nwill contain the following properties: `req`, `res`. And the `req` property\nwill be an {Object} containing `method`, `url`, `headers`, the `res` property\nwill be an {Object} containing `statusCode`, `statusMessage`, `headers`.\n\nThis could add additional memory overhead and should only be used for\ndiagnostic purposes, not left turned on in production by default.","summary":"When `performanceEntry.type` is equal to `'http'`, the `performanceNodeEntry.detail` property will be an {Object} containing additional information.","examples":[],"children":[]},{"kind":"section","id":"http2-http2-details","name":"HTTP/2 ('http2') Details","title":"HTTP/2 ('http2') Details","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"When `performanceEntry.type` is equal to `'http2'`, the\n`performanceNodeEntry.detail` property will be an {Object} containing\nadditional performance information.\n\nIf `performanceEntry.name` is equal to `Http2Stream`, the `detail`\nwill contain the following properties:\n\n* `bytesRead` {number} The number of `DATA` frame bytes received for this\n  `Http2Stream`.\n* `bytesWritten` {number} The number of `DATA` frame bytes sent for this\n  `Http2Stream`.\n* `id` {number} The identifier of the associated `Http2Stream`\n* `timeToFirstByte` {number} The number of milliseconds elapsed between the\n  `PerformanceEntry` `startTime` and the reception of the first `DATA` frame.\n* `timeToFirstByteSent` {number} The number of milliseconds elapsed between\n  the `PerformanceEntry` `startTime` and sending of the first `DATA` frame.\n* `timeToFirstHeader` {number} The number of milliseconds elapsed between the\n  `PerformanceEntry` `startTime` and the reception of the first header.\n\nIf `performanceEntry.name` is equal to `Http2Session`, the `detail` will\ncontain the following properties:\n\n* `bytesRead` {number} The number of bytes received for this `Http2Session`.\n* `bytesWritten` {number} The number of bytes sent for this `Http2Session`.\n* `framesReceived` {number} The number of HTTP/2 frames received by the\n  `Http2Session`.\n* `framesSent` {number} The number of HTTP/2 frames sent by the `Http2Session`.\n* `maxConcurrentStreams` {number} The maximum number of streams concurrently\n  open during the lifetime of the `Http2Session`.\n* `pingRTT` {number} The number of milliseconds elapsed since the transmission\n  of a `PING` frame and the reception of its acknowledgment. Only present if\n  a `PING` frame has been sent on the `Http2Session`.\n* `streamAverageDuration` {number} The average duration (in milliseconds) for\n  all `Http2Stream` instances.\n* `streamCount` {number} The number of `Http2Stream` instances processed by\n  the `Http2Session`.\n* `type` {string} Either `'server'` or `'client'` to identify the type of\n  `Http2Session`.","summary":"When `performanceEntry.type` is equal to `'http2'`, the `performanceNodeEntry.detail` property will be an {Object} containing additional performance information.","examples":[],"children":[]},{"kind":"section","id":"timerify-function-details","name":"Timerify ('function') Details","title":"Timerify ('function') Details","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"When `performanceEntry.type` is equal to `'function'`, the\n`performanceNodeEntry.detail` property will be an {Array} listing\nthe input arguments to the timed function.","summary":"When `performanceEntry.type` is equal to `'function'`, the `performanceNodeEntry.detail` property will be an {Array} listing the input arguments to the timed function.","examples":[],"children":[]},{"kind":"section","id":"net-net-details","name":"Net ('net') Details","title":"Net ('net') Details","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"When `performanceEntry.type` is equal to `'net'`, the\n`performanceNodeEntry.detail` property will be an {Object} containing\nadditional information.\n\nIf `performanceEntry.name` is equal to `connect`, the `detail`\nwill contain the following properties: `host`, `port`.","summary":"When `performanceEntry.type` is equal to `'net'`, the `performanceNodeEntry.detail` property will be an {Object} containing additional information.","examples":[],"children":[]},{"kind":"section","id":"dns-dns-details","name":"DNS ('dns') Details","title":"DNS ('dns') Details","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"When `performanceEntry.type` is equal to `'dns'`, the\n`performanceNodeEntry.detail` property will be an {Object} containing\nadditional information.\n\nIf `performanceEntry.name` is equal to `lookup`, the `detail`\nwill contain the following properties: `hostname`, `family`, `hints`, `verbatim`,\n`addresses`.\n\nIf `performanceEntry.name` is equal to `lookupService`, the `detail` will\ncontain the following properties: `host`, `port`, `hostname`, `service`.\n\nIf `performanceEntry.name` is equal to `queryxxx` or `getHostByAddr`, the `detail` will\ncontain the following properties: `host`, `ttl`, `result`. The value of `result` is\nsame as the result of `queryxxx` or `getHostByAddr`.","summary":"When `performanceEntry.type` is equal to `'dns'`, the `performanceNodeEntry.detail` property will be an {Object} containing additional information.","examples":[],"children":[]}]},{"kind":"class","id":"class-performancenodetiming","name":"PerformanceNodeTiming","title":"Class: `PerformanceNodeTiming`","scope":"module","overloadOf":null,"stability":null,"added":["v8.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":{"text":"PerformanceEntry","links":[{"name":"PerformanceEntry","href":"perf_hooks.html#class-performanceentry","start":0,"end":16}]},"description":"*This property is an extension by Node.js. It is not available in Web browsers.*\n\nProvides timing details for Node.js itself. The constructor of this class\nis not exposed to users.","summary":"_This property is an extension by Node.js. It is not available in Web browsers._","examples":[],"children":[{"kind":"property","id":"performancenodetimingbootstrapcomplete","name":"bootstrapComplete","title":"`performanceNodeTiming.bootstrapComplete`","scope":"module","overloadOf":null,"stability":null,"added":["v8.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The high resolution millisecond timestamp at which the Node.js process\ncompleted bootstrapping. If bootstrapping has not yet finished, the property\nhas the value of -1.","summary":"The high resolution millisecond timestamp at which the Node.js process completed bootstrapping. If bootstrapping has not yet finished, the property has the value of -1.","examples":[],"children":[]},{"kind":"property","id":"performancenodetimingenvironment","name":"environment","title":"`performanceNodeTiming.environment`","scope":"module","overloadOf":null,"stability":null,"added":["v8.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The high resolution millisecond timestamp at which the Node.js environment was\ninitialized.","summary":"The high resolution millisecond timestamp at which the Node.js environment was initialized.","examples":[],"children":[]},{"kind":"property","id":"performancenodetimingidletime","name":"idleTime","title":"`performanceNodeTiming.idleTime`","scope":"module","overloadOf":null,"stability":null,"added":["v14.10.0","v12.19.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The high resolution millisecond timestamp of the amount of time the event loop\nhas been idle within the event loop's event provider (e.g. `epoll_wait`). This\ndoes not take CPU usage into consideration. If the event loop has not yet\nstarted (e.g., in the first tick of the main script), the property has the\nvalue of 0.","summary":"The high resolution millisecond timestamp of the amount of time the event loop has been idle within the event loop's event provider (e.g. `epoll_wait`). This does not take CPU usage into consideration. If the event loop has not yet started (e.g., in the first tick of the main script), the property has the value of 0.","examples":[],"children":[]},{"kind":"property","id":"performancenodetimingloopexit","name":"loopExit","title":"`performanceNodeTiming.loopExit`","scope":"module","overloadOf":null,"stability":null,"added":["v8.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The high resolution millisecond timestamp at which the Node.js event loop\nexited. If the event loop has not yet exited, the property has the value of -1.\nIt can only have a value of not -1 in a handler of the [`'exit'`](process.html#event-exit) event.","summary":"The high resolution millisecond timestamp at which the Node.js event loop exited. If the event loop has not yet exited, the property has the value of -1. It can only have a value of not -1 in a handler of the `'exit'` event.","examples":[],"children":[]},{"kind":"property","id":"performancenodetimingloopstart","name":"loopStart","title":"`performanceNodeTiming.loopStart`","scope":"module","overloadOf":null,"stability":null,"added":["v8.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The high resolution millisecond timestamp at which the Node.js event loop\nstarted. If the event loop has not yet started (e.g., in the first tick of the\nmain script), the property has the value of -1.","summary":"The high resolution millisecond timestamp at which the Node.js event loop started. If the event loop has not yet started (e.g., in the first tick of the main script), the property has the value of -1.","examples":[],"children":[]},{"kind":"property","id":"performancenodetimingnodestart","name":"nodeStart","title":"`performanceNodeTiming.nodeStart`","scope":"module","overloadOf":null,"stability":null,"added":["v8.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The high resolution millisecond timestamp at which the Node.js process was\ninitialized.","summary":"The high resolution millisecond timestamp at which the Node.js process was initialized.","examples":[],"children":[]},{"kind":"property","id":"performancenodetiminguvmetricsinfo","name":"uvMetricsInfo","title":"`performanceNodeTiming.uvMetricsInfo`","scope":"module","overloadOf":null,"stability":null,"added":["v22.8.0","v20.18.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"default":null,"description":"This is a wrapper to the `uv_metrics_info` function.\nIt returns the current set of event loop metrics.\n\nIt is recommended to use this property inside a function whose execution was\nscheduled using `setImmediate` to avoid collecting metrics before finishing all\noperations scheduled during the current loop iteration.\n\n```cjs\nconst { performance } = require('node:perf_hooks');\n\nsetImmediate(() => {\n  console.log(performance.nodeTiming.uvMetricsInfo);\n});\n```\n\n```mjs\nimport { performance } from 'node:perf_hooks';\n\nsetImmediate(() => {\n  console.log(performance.nodeTiming.uvMetricsInfo);\n});\n```","summary":"This is a wrapper to the `uv_metrics_info` function. It returns the current set of event loop metrics.","examples":[{"language":"cjs","displayName":null,"code":"const { performance } = require('node:perf_hooks');\n\nsetImmediate(() => {\n  console.log(performance.nodeTiming.uvMetricsInfo);\n});"},{"language":"mjs","displayName":null,"code":"import { performance } from 'node:perf_hooks';\n\nsetImmediate(() => {\n  console.log(performance.nodeTiming.uvMetricsInfo);\n});"}],"children":[]},{"kind":"property","id":"performancenodetimingv8start","name":"v8Start","title":"`performanceNodeTiming.v8Start`","scope":"module","overloadOf":null,"stability":null,"added":["v8.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The high resolution millisecond timestamp at which the V8 platform was\ninitialized.","summary":"The high resolution millisecond timestamp at which the V8 platform was initialized.","examples":[],"children":[]}]},{"kind":"class","id":"class-performanceresourcetiming","name":"PerformanceResourceTiming","title":"Class: `PerformanceResourceTiming`","scope":"module","overloadOf":null,"stability":null,"added":["v18.2.0","v16.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":{"text":"PerformanceEntry","links":[{"name":"PerformanceEntry","href":"perf_hooks.html#class-performanceentry","start":0,"end":16}]},"description":"Provides detailed network timing data regarding the loading of an application's\nresources.\n\nThe constructor of this class is not exposed to users directly.","summary":"Provides detailed network timing data regarding the loading of an application's resources.","examples":[],"children":[{"kind":"property","id":"performanceresourcetimingworkerstart","name":"workerStart","title":"`performanceResourceTiming.workerStart`","scope":"module","overloadOf":null,"stability":null,"added":["v18.2.0","v16.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v19.0.0"],"prUrl":"https://github.com/nodejs/node/pull/44483","commit":null,"description":"This property getter must be called with the `PerformanceResourceTiming` object as the receiver."}],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The high resolution millisecond timestamp at immediately before dispatching\nthe `fetch` request. If the resource is not intercepted by a worker the property\nwill always return 0.","summary":"The high resolution millisecond timestamp at immediately before dispatching the `fetch` request. If the resource is not intercepted by a worker the property will always return 0.","examples":[],"children":[]},{"kind":"property","id":"performanceresourcetimingredirectstart","name":"redirectStart","title":"`performanceResourceTiming.redirectStart`","scope":"module","overloadOf":null,"stability":null,"added":["v18.2.0","v16.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v19.0.0"],"prUrl":"https://github.com/nodejs/node/pull/44483","commit":null,"description":"This property getter must be called with the `PerformanceResourceTiming` object as the receiver."}],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The high resolution millisecond timestamp that represents the start time\nof the fetch which initiates the redirect.","summary":"The high resolution millisecond timestamp that represents the start time of the fetch which initiates the redirect.","examples":[],"children":[]},{"kind":"property","id":"performanceresourcetimingredirectend","name":"redirectEnd","title":"`performanceResourceTiming.redirectEnd`","scope":"module","overloadOf":null,"stability":null,"added":["v18.2.0","v16.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v19.0.0"],"prUrl":"https://github.com/nodejs/node/pull/44483","commit":null,"description":"This property getter must be called with the `PerformanceResourceTiming` object as the receiver."}],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The high resolution millisecond timestamp that will be created immediately after\nreceiving the last byte of the response of the last redirect.","summary":"The high resolution millisecond timestamp that will be created immediately after receiving the last byte of the response of the last redirect.","examples":[],"children":[]},{"kind":"property","id":"performanceresourcetimingfetchstart","name":"fetchStart","title":"`performanceResourceTiming.fetchStart`","scope":"module","overloadOf":null,"stability":null,"added":["v18.2.0","v16.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v19.0.0"],"prUrl":"https://github.com/nodejs/node/pull/44483","commit":null,"description":"This property getter must be called with the `PerformanceResourceTiming` object as the receiver."}],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The high resolution millisecond timestamp immediately before the Node.js starts\nto fetch the resource.","summary":"The high resolution millisecond timestamp immediately before the Node.js starts to fetch the resource.","examples":[],"children":[]},{"kind":"property","id":"performanceresourcetimingdomainlookupstart","name":"domainLookupStart","title":"`performanceResourceTiming.domainLookupStart`","scope":"module","overloadOf":null,"stability":null,"added":["v18.2.0","v16.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v19.0.0"],"prUrl":"https://github.com/nodejs/node/pull/44483","commit":null,"description":"This property getter must be called with the `PerformanceResourceTiming` object as the receiver."}],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The high resolution millisecond timestamp immediately before the Node.js starts\nthe domain name lookup for the resource.","summary":"The high resolution millisecond timestamp immediately before the Node.js starts the domain name lookup for the resource.","examples":[],"children":[]},{"kind":"property","id":"performanceresourcetimingdomainlookupend","name":"domainLookupEnd","title":"`performanceResourceTiming.domainLookupEnd`","scope":"module","overloadOf":null,"stability":null,"added":["v18.2.0","v16.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v19.0.0"],"prUrl":"https://github.com/nodejs/node/pull/44483","commit":null,"description":"This property getter must be called with the `PerformanceResourceTiming` object as the receiver."}],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The high resolution millisecond timestamp representing the time immediately\nafter the Node.js finished the domain name lookup for the resource.","summary":"The high resolution millisecond timestamp representing the time immediately after the Node.js finished the domain name lookup for the resource.","examples":[],"children":[]},{"kind":"property","id":"performanceresourcetimingconnectstart","name":"connectStart","title":"`performanceResourceTiming.connectStart`","scope":"module","overloadOf":null,"stability":null,"added":["v18.2.0","v16.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v19.0.0"],"prUrl":"https://github.com/nodejs/node/pull/44483","commit":null,"description":"This property getter must be called with the `PerformanceResourceTiming` object as the receiver."}],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The high resolution millisecond timestamp representing the time immediately\nbefore Node.js starts to establish the connection to the server to retrieve\nthe resource.","summary":"The high resolution millisecond timestamp representing the time immediately before Node.js starts to establish the connection to the server to retrieve the resource.","examples":[],"children":[]},{"kind":"property","id":"performanceresourcetimingconnectend","name":"connectEnd","title":"`performanceResourceTiming.connectEnd`","scope":"module","overloadOf":null,"stability":null,"added":["v18.2.0","v16.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v19.0.0"],"prUrl":"https://github.com/nodejs/node/pull/44483","commit":null,"description":"This property getter must be called with the `PerformanceResourceTiming` object as the receiver."}],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The high resolution millisecond timestamp representing the time immediately\nafter Node.js finishes establishing the connection to the server to retrieve\nthe resource.","summary":"The high resolution millisecond timestamp representing the time immediately after Node.js finishes establishing the connection to the server to retrieve the resource.","examples":[],"children":[]},{"kind":"property","id":"performanceresourcetimingsecureconnectionstart","name":"secureConnectionStart","title":"`performanceResourceTiming.secureConnectionStart`","scope":"module","overloadOf":null,"stability":null,"added":["v18.2.0","v16.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v19.0.0"],"prUrl":"https://github.com/nodejs/node/pull/44483","commit":null,"description":"This property getter must be called with the `PerformanceResourceTiming` object as the receiver."}],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The high resolution millisecond timestamp representing the time immediately\nbefore Node.js starts the handshake process to secure the current connection.","summary":"The high resolution millisecond timestamp representing the time immediately before Node.js starts the handshake process to secure the current connection.","examples":[],"children":[]},{"kind":"property","id":"performanceresourcetimingrequeststart","name":"requestStart","title":"`performanceResourceTiming.requestStart`","scope":"module","overloadOf":null,"stability":null,"added":["v18.2.0","v16.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v19.0.0"],"prUrl":"https://github.com/nodejs/node/pull/44483","commit":null,"description":"This property getter must be called with the `PerformanceResourceTiming` object as the receiver."}],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The high resolution millisecond timestamp representing the time immediately\nbefore Node.js receives the first byte of the response from the server.","summary":"The high resolution millisecond timestamp representing the time immediately before Node.js receives the first byte of the response from the server.","examples":[],"children":[]},{"kind":"property","id":"performanceresourcetimingresponseend","name":"responseEnd","title":"`performanceResourceTiming.responseEnd`","scope":"module","overloadOf":null,"stability":null,"added":["v18.2.0","v16.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v19.0.0"],"prUrl":"https://github.com/nodejs/node/pull/44483","commit":null,"description":"This property getter must be called with the `PerformanceResourceTiming` object as the receiver."}],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The high resolution millisecond timestamp representing the time immediately\nafter Node.js receives the last byte of the resource or immediately before\nthe transport connection is closed, whichever comes first.","summary":"The high resolution millisecond timestamp representing the time immediately after Node.js receives the last byte of the resource or immediately before the transport connection is closed, whichever comes first.","examples":[],"children":[]},{"kind":"property","id":"performanceresourcetimingtransfersize","name":"transferSize","title":"`performanceResourceTiming.transferSize`","scope":"module","overloadOf":null,"stability":null,"added":["v18.2.0","v16.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v19.0.0"],"prUrl":"https://github.com/nodejs/node/pull/44483","commit":null,"description":"This property getter must be called with the `PerformanceResourceTiming` object as the receiver."}],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"A number representing the size (in octets) of the fetched resource. The size\nincludes the response header fields plus the response payload body.","summary":"A number representing the size (in octets) of the fetched resource. The size includes the response header fields plus the response payload body.","examples":[],"children":[]},{"kind":"property","id":"performanceresourcetimingencodedbodysize","name":"encodedBodySize","title":"`performanceResourceTiming.encodedBodySize`","scope":"module","overloadOf":null,"stability":null,"added":["v18.2.0","v16.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v19.0.0"],"prUrl":"https://github.com/nodejs/node/pull/44483","commit":null,"description":"This property getter must be called with the `PerformanceResourceTiming` object as the receiver."}],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"A number representing the size (in octets) received from the fetch\n(HTTP or cache), of the payload body, before removing any applied\ncontent-codings.","summary":"A number representing the size (in octets) received from the fetch (HTTP or cache), of the payload body, before removing any applied content-codings.","examples":[],"children":[]},{"kind":"property","id":"performanceresourcetimingdecodedbodysize","name":"decodedBodySize","title":"`performanceResourceTiming.decodedBodySize`","scope":"module","overloadOf":null,"stability":null,"added":["v18.2.0","v16.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v19.0.0"],"prUrl":"https://github.com/nodejs/node/pull/44483","commit":null,"description":"This property getter must be called with the `PerformanceResourceTiming` object as the receiver."}],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"A number representing the size (in octets) received from the fetch\n(HTTP or cache), of the message body, after removing any applied\ncontent-codings.","summary":"A number representing the size (in octets) received from the fetch (HTTP or cache), of the message body, after removing any applied content-codings.","examples":[],"children":[]},{"kind":"method","id":"performanceresourcetimingtojson","name":"toJSON","title":"`performanceResourceTiming.toJSON()`","scope":"module","overloadOf":null,"stability":null,"added":["v18.2.0","v16.17.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v19.0.0"],"prUrl":"https://github.com/nodejs/node/pull/44483","commit":null,"description":"This method must be called with the `PerformanceResourceTiming` object as the receiver."}],"signature":{"parameters":[],"returns":null},"description":"Returns a `object` that is the JSON representation of the\n`PerformanceResourceTiming` object","summary":"Returns a `object` that is the JSON representation of the `PerformanceResourceTiming` object","examples":[],"children":[]}]},{"kind":"class","id":"class-performanceobserver","name":"PerformanceObserver","title":"Class: `PerformanceObserver`","scope":"module","overloadOf":null,"stability":null,"added":["v8.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":null,"description":"","summary":"","examples":[],"children":[{"kind":"property","id":"performanceobserversupportedentrytypes","name":"supportedEntryTypes","title":"`PerformanceObserver.supportedEntryTypes`","scope":"module","overloadOf":null,"stability":null,"added":["v16.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"string[]","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"default":null,"description":"Get supported types.","summary":"Get supported types.","examples":[],"children":[]},{"kind":"constructor","id":"new-performanceobservercallback","name":"PerformanceObserver","title":"`new PerformanceObserver(callback)`","scope":"module","overloadOf":null,"stability":null,"added":["v8.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v18.0.0"],"prUrl":"https://github.com/nodejs/node/pull/41678","commit":null,"description":"Passing an invalid callback to the `callback` argument now throws `ERR_INVALID_ARG_TYPE` instead of `ERR_INVALID_CALLBACK`."}],"signature":{"parameters":[{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[{"name":"list","type":{"text":"PerformanceObserverEntryList","links":[{"name":"PerformanceObserverEntryList","href":"perf_hooks.html#class-performanceobserverentrylist","start":0,"end":28}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"observer","type":{"text":"PerformanceObserver","links":[{"name":"PerformanceObserver","href":"perf_hooks.html#class-performanceobserver","start":0,"end":19}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":null},"description":"`PerformanceObserver` objects provide notifications when new\n`PerformanceEntry` instances have been added to the Performance Timeline.\n\n```mjs\nimport { performance, PerformanceObserver } from 'node:perf_hooks';\n\nconst obs = new PerformanceObserver((list, observer) => {\n  console.log(list.getEntries());\n\n  performance.clearMarks();\n  performance.clearMeasures();\n  observer.disconnect();\n});\nobs.observe({ entryTypes: ['mark'], buffered: true });\n\nperformance.mark('test');\n```\n\n```cjs\nconst {\n  performance,\n  PerformanceObserver,\n} = require('node:perf_hooks');\n\nconst obs = new PerformanceObserver((list, observer) => {\n  console.log(list.getEntries());\n\n  performance.clearMarks();\n  performance.clearMeasures();\n  observer.disconnect();\n});\nobs.observe({ entryTypes: ['mark'], buffered: true });\n\nperformance.mark('test');\n```\n\nBecause `PerformanceObserver` instances introduce their own additional\nperformance overhead, instances should not be left subscribed to notifications\nindefinitely. Users should disconnect observers as soon as they are no\nlonger needed.\n\nThe `callback` is invoked when a `PerformanceObserver` is\nnotified about new `PerformanceEntry` instances. The callback receives a\n`PerformanceObserverEntryList` instance and a reference to the\n`PerformanceObserver`.","summary":"`PerformanceObserver` objects provide notifications when new `PerformanceEntry` instances have been added to the Performance Timeline.","examples":[{"language":"mjs","displayName":null,"code":"import { performance, PerformanceObserver } from 'node:perf_hooks';\n\nconst obs = new PerformanceObserver((list, observer) => {\n  console.log(list.getEntries());\n\n  performance.clearMarks();\n  performance.clearMeasures();\n  observer.disconnect();\n});\nobs.observe({ entryTypes: ['mark'], buffered: true });\n\nperformance.mark('test');"},{"language":"cjs","displayName":null,"code":"const {\n  performance,\n  PerformanceObserver,\n} = require('node:perf_hooks');\n\nconst obs = new PerformanceObserver((list, observer) => {\n  console.log(list.getEntries());\n\n  performance.clearMarks();\n  performance.clearMeasures();\n  observer.disconnect();\n});\nobs.observe({ entryTypes: ['mark'], buffered: true });\n\nperformance.mark('test');"}],"children":[]},{"kind":"method","id":"performanceobserverdisconnect","name":"disconnect","title":"`performanceObserver.disconnect()`","scope":"module","overloadOf":null,"stability":null,"added":["v8.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"Disconnects the `PerformanceObserver` instance from all notifications.","summary":"Disconnects the `PerformanceObserver` instance from all notifications.","examples":[],"children":[]},{"kind":"method","id":"performanceobserverobserveoptions","name":"observe","title":"`performanceObserver.observe(options)`","scope":"module","overloadOf":null,"stability":null,"added":["v8.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v16.7.0"],"prUrl":"https://github.com/nodejs/node/pull/39297","commit":null,"description":"Updated to conform to Performance Timeline Level 2. The buffered option has been added back."},{"versions":["v16.0.0"],"prUrl":"https://github.com/nodejs/node/pull/37136","commit":null,"description":"Updated to conform to User Timing Level 3. The buffered option has been removed."}],"signature":{"parameters":[{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[{"name":"type","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"A single {PerformanceEntry} type. Must not be given\nif `entryTypes` is already specified.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"entryTypes","type":{"text":"string[]","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"An array of strings identifying the types of\n{PerformanceEntry} instances the observer is interested in. If not\nprovided an error will be thrown.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"buffered","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"If true, the observer callback is called with a\nlist global `PerformanceEntry` buffered entries. If false, only\n`PerformanceEntry`s created after the time point are sent to the\nobserver callback.","default":"false","optional":true,"rest":false,"properties":[]}]}],"returns":null},"description":"Subscribes the {PerformanceObserver} instance to notifications of new\n{PerformanceEntry} instances identified either by `options.entryTypes`\nor `options.type`:\n\n```mjs\nimport { performance, PerformanceObserver } from 'node:perf_hooks';\n\nconst obs = new PerformanceObserver((list, observer) => {\n  // Called once asynchronously. `list` contains three items.\n});\nobs.observe({ type: 'mark' });\n\nfor (let n = 0; n < 3; n++)\n  performance.mark(`test${n}`);\n```\n\n```cjs\nconst {\n  performance,\n  PerformanceObserver,\n} = require('node:perf_hooks');\n\nconst obs = new PerformanceObserver((list, observer) => {\n  // Called once asynchronously. `list` contains three items.\n});\nobs.observe({ type: 'mark' });\n\nfor (let n = 0; n < 3; n++)\n  performance.mark(`test${n}`);\n```","summary":"Subscribes the {PerformanceObserver} instance to notifications of new {PerformanceEntry} instances identified either by `options.entryTypes` or `options.type`:","examples":[{"language":"mjs","displayName":null,"code":"import { performance, PerformanceObserver } from 'node:perf_hooks';\n\nconst obs = new PerformanceObserver((list, observer) => {\n  // Called once asynchronously. `list` contains three items.\n});\nobs.observe({ type: 'mark' });\n\nfor (let n = 0; n < 3; n++)\n  performance.mark(`test${n}`);"},{"language":"cjs","displayName":null,"code":"const {\n  performance,\n  PerformanceObserver,\n} = require('node:perf_hooks');\n\nconst obs = new PerformanceObserver((list, observer) => {\n  // Called once asynchronously. `list` contains three items.\n});\nobs.observe({ type: 'mark' });\n\nfor (let n = 0; n < 3; n++)\n  performance.mark(`test${n}`);"}],"children":[]},{"kind":"method","id":"performanceobservertakerecords","name":"takeRecords","title":"`performanceObserver.takeRecords()`","scope":"module","overloadOf":null,"stability":null,"added":["v16.0.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"PerformanceEntry[]","links":[{"name":"PerformanceEntry","href":"perf_hooks.html#class-performanceentry","start":0,"end":16}]},"description":"Current list of entries stored in the performance observer, emptying it out."}},"description":"","summary":"","examples":[],"children":[]}]},{"kind":"class","id":"class-performanceobserverentrylist","name":"PerformanceObserverEntryList","title":"Class: `PerformanceObserverEntryList`","scope":"module","overloadOf":null,"stability":null,"added":["v8.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":null,"description":"The `PerformanceObserverEntryList` class is used to provide access to the\n`PerformanceEntry` instances passed to a `PerformanceObserver`.\nThe constructor of this class is not exposed to users.","summary":"The `PerformanceObserverEntryList` class is used to provide access to the `PerformanceEntry` instances passed to a `PerformanceObserver`. The constructor of this class is not exposed to users.","examples":[],"children":[{"kind":"method","id":"performanceobserverentrylistgetentries","name":"getEntries","title":"`performanceObserverEntryList.getEntries()`","scope":"module","overloadOf":null,"stability":null,"added":["v8.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"PerformanceEntry[]","links":[{"name":"PerformanceEntry","href":"perf_hooks.html#class-performanceentry","start":0,"end":16}]},"description":""}},"description":"Returns a list of `PerformanceEntry` objects in chronological order\nwith respect to `performanceEntry.startTime`.\n\n```mjs\nimport { performance, PerformanceObserver } from 'node:perf_hooks';\n\nconst obs = new PerformanceObserver((perfObserverList, observer) => {\n  console.log(perfObserverList.getEntries());\n  /**\n   * [\n   *   PerformanceEntry {\n   *     name: 'test',\n   *     entryType: 'mark',\n   *     startTime: 81.465639,\n   *     duration: 0,\n   *     detail: null\n   *   },\n   *   PerformanceEntry {\n   *     name: 'meow',\n   *     entryType: 'mark',\n   *     startTime: 81.860064,\n   *     duration: 0,\n   *     detail: null\n   *   }\n   * ]\n   */\n\n  performance.clearMarks();\n  performance.clearMeasures();\n  observer.disconnect();\n});\nobs.observe({ type: 'mark' });\n\nperformance.mark('test');\nperformance.mark('meow');\n```\n\n```cjs\nconst {\n  performance,\n  PerformanceObserver,\n} = require('node:perf_hooks');\n\nconst obs = new PerformanceObserver((perfObserverList, observer) => {\n  console.log(perfObserverList.getEntries());\n  /**\n   * [\n   *   PerformanceEntry {\n   *     name: 'test',\n   *     entryType: 'mark',\n   *     startTime: 81.465639,\n   *     duration: 0,\n   *     detail: null\n   *   },\n   *   PerformanceEntry {\n   *     name: 'meow',\n   *     entryType: 'mark',\n   *     startTime: 81.860064,\n   *     duration: 0,\n   *     detail: null\n   *   }\n   * ]\n   */\n\n  performance.clearMarks();\n  performance.clearMeasures();\n  observer.disconnect();\n});\nobs.observe({ type: 'mark' });\n\nperformance.mark('test');\nperformance.mark('meow');\n```","summary":"Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`.","examples":[{"language":"mjs","displayName":null,"code":"import { performance, PerformanceObserver } from 'node:perf_hooks';\n\nconst obs = new PerformanceObserver((perfObserverList, observer) => {\n  console.log(perfObserverList.getEntries());\n  /**\n   * [\n   *   PerformanceEntry {\n   *     name: 'test',\n   *     entryType: 'mark',\n   *     startTime: 81.465639,\n   *     duration: 0,\n   *     detail: null\n   *   },\n   *   PerformanceEntry {\n   *     name: 'meow',\n   *     entryType: 'mark',\n   *     startTime: 81.860064,\n   *     duration: 0,\n   *     detail: null\n   *   }\n   * ]\n   */\n\n  performance.clearMarks();\n  performance.clearMeasures();\n  observer.disconnect();\n});\nobs.observe({ type: 'mark' });\n\nperformance.mark('test');\nperformance.mark('meow');"},{"language":"cjs","displayName":null,"code":"const {\n  performance,\n  PerformanceObserver,\n} = require('node:perf_hooks');\n\nconst obs = new PerformanceObserver((perfObserverList, observer) => {\n  console.log(perfObserverList.getEntries());\n  /**\n   * [\n   *   PerformanceEntry {\n   *     name: 'test',\n   *     entryType: 'mark',\n   *     startTime: 81.465639,\n   *     duration: 0,\n   *     detail: null\n   *   },\n   *   PerformanceEntry {\n   *     name: 'meow',\n   *     entryType: 'mark',\n   *     startTime: 81.860064,\n   *     duration: 0,\n   *     detail: null\n   *   }\n   * ]\n   */\n\n  performance.clearMarks();\n  performance.clearMeasures();\n  observer.disconnect();\n});\nobs.observe({ type: 'mark' });\n\nperformance.mark('test');\nperformance.mark('meow');"}],"children":[]},{"kind":"method","id":"performanceobserverentrylistgetentriesbynamename-type","name":"getEntriesByName","title":"`performanceObserverEntryList.getEntriesByName(name[, type])`","scope":"module","overloadOf":null,"stability":null,"added":["v8.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"name","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"type","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"PerformanceEntry[]","links":[{"name":"PerformanceEntry","href":"perf_hooks.html#class-performanceentry","start":0,"end":16}]},"description":""}},"description":"Returns a list of `PerformanceEntry` objects in chronological order\nwith respect to `performanceEntry.startTime` whose `performanceEntry.name` is\nequal to `name`, and optionally, whose `performanceEntry.entryType` is equal to\n`type`.\n\n```mjs\nimport { performance, PerformanceObserver } from 'node:perf_hooks';\n\nconst obs = new PerformanceObserver((perfObserverList, observer) => {\n  console.log(perfObserverList.getEntriesByName('meow'));\n  /**\n   * [\n   *   PerformanceEntry {\n   *     name: 'meow',\n   *     entryType: 'mark',\n   *     startTime: 98.545991,\n   *     duration: 0,\n   *     detail: null\n   *   }\n   * ]\n   */\n  console.log(perfObserverList.getEntriesByName('nope')); // []\n\n  console.log(perfObserverList.getEntriesByName('test', 'mark'));\n  /**\n   * [\n   *   PerformanceEntry {\n   *     name: 'test',\n   *     entryType: 'mark',\n   *     startTime: 63.518931,\n   *     duration: 0,\n   *     detail: null\n   *   }\n   * ]\n   */\n  console.log(perfObserverList.getEntriesByName('test', 'measure')); // []\n\n  performance.clearMarks();\n  performance.clearMeasures();\n  observer.disconnect();\n});\nobs.observe({ entryTypes: ['mark', 'measure'] });\n\nperformance.mark('test');\nperformance.mark('meow');\n```\n\n```cjs\nconst {\n  performance,\n  PerformanceObserver,\n} = require('node:perf_hooks');\n\nconst obs = new PerformanceObserver((perfObserverList, observer) => {\n  console.log(perfObserverList.getEntriesByName('meow'));\n  /**\n   * [\n   *   PerformanceEntry {\n   *     name: 'meow',\n   *     entryType: 'mark',\n   *     startTime: 98.545991,\n   *     duration: 0,\n   *     detail: null\n   *   }\n   * ]\n   */\n  console.log(perfObserverList.getEntriesByName('nope')); // []\n\n  console.log(perfObserverList.getEntriesByName('test', 'mark'));\n  /**\n   * [\n   *   PerformanceEntry {\n   *     name: 'test',\n   *     entryType: 'mark',\n   *     startTime: 63.518931,\n   *     duration: 0,\n   *     detail: null\n   *   }\n   * ]\n   */\n  console.log(perfObserverList.getEntriesByName('test', 'measure')); // []\n\n  performance.clearMarks();\n  performance.clearMeasures();\n  observer.disconnect();\n});\nobs.observe({ entryTypes: ['mark', 'measure'] });\n\nperformance.mark('test');\nperformance.mark('meow');\n```","summary":"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`.","examples":[{"language":"mjs","displayName":null,"code":"import { performance, PerformanceObserver } from 'node:perf_hooks';\n\nconst obs = new PerformanceObserver((perfObserverList, observer) => {\n  console.log(perfObserverList.getEntriesByName('meow'));\n  /**\n   * [\n   *   PerformanceEntry {\n   *     name: 'meow',\n   *     entryType: 'mark',\n   *     startTime: 98.545991,\n   *     duration: 0,\n   *     detail: null\n   *   }\n   * ]\n   */\n  console.log(perfObserverList.getEntriesByName('nope')); // []\n\n  console.log(perfObserverList.getEntriesByName('test', 'mark'));\n  /**\n   * [\n   *   PerformanceEntry {\n   *     name: 'test',\n   *     entryType: 'mark',\n   *     startTime: 63.518931,\n   *     duration: 0,\n   *     detail: null\n   *   }\n   * ]\n   */\n  console.log(perfObserverList.getEntriesByName('test', 'measure')); // []\n\n  performance.clearMarks();\n  performance.clearMeasures();\n  observer.disconnect();\n});\nobs.observe({ entryTypes: ['mark', 'measure'] });\n\nperformance.mark('test');\nperformance.mark('meow');"},{"language":"cjs","displayName":null,"code":"const {\n  performance,\n  PerformanceObserver,\n} = require('node:perf_hooks');\n\nconst obs = new PerformanceObserver((perfObserverList, observer) => {\n  console.log(perfObserverList.getEntriesByName('meow'));\n  /**\n   * [\n   *   PerformanceEntry {\n   *     name: 'meow',\n   *     entryType: 'mark',\n   *     startTime: 98.545991,\n   *     duration: 0,\n   *     detail: null\n   *   }\n   * ]\n   */\n  console.log(perfObserverList.getEntriesByName('nope')); // []\n\n  console.log(perfObserverList.getEntriesByName('test', 'mark'));\n  /**\n   * [\n   *   PerformanceEntry {\n   *     name: 'test',\n   *     entryType: 'mark',\n   *     startTime: 63.518931,\n   *     duration: 0,\n   *     detail: null\n   *   }\n   * ]\n   */\n  console.log(perfObserverList.getEntriesByName('test', 'measure')); // []\n\n  performance.clearMarks();\n  performance.clearMeasures();\n  observer.disconnect();\n});\nobs.observe({ entryTypes: ['mark', 'measure'] });\n\nperformance.mark('test');\nperformance.mark('meow');"}],"children":[]},{"kind":"method","id":"performanceobserverentrylistgetentriesbytypetype","name":"getEntriesByType","title":"`performanceObserverEntryList.getEntriesByType(type)`","scope":"module","overloadOf":null,"stability":null,"added":["v8.5.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"type","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"PerformanceEntry[]","links":[{"name":"PerformanceEntry","href":"perf_hooks.html#class-performanceentry","start":0,"end":16}]},"description":""}},"description":"Returns a list of `PerformanceEntry` objects in chronological order\nwith respect to `performanceEntry.startTime` whose `performanceEntry.entryType`\nis equal to `type`.\n\n```mjs\nimport { performance, PerformanceObserver } from 'node:perf_hooks';\n\nconst obs = new PerformanceObserver((perfObserverList, observer) => {\n  console.log(perfObserverList.getEntriesByType('mark'));\n  /**\n   * [\n   *   PerformanceEntry {\n   *     name: 'test',\n   *     entryType: 'mark',\n   *     startTime: 55.897834,\n   *     duration: 0,\n   *     detail: null\n   *   },\n   *   PerformanceEntry {\n   *     name: 'meow',\n   *     entryType: 'mark',\n   *     startTime: 56.350146,\n   *     duration: 0,\n   *     detail: null\n   *   }\n   * ]\n   */\n  performance.clearMarks();\n  performance.clearMeasures();\n  observer.disconnect();\n});\nobs.observe({ type: 'mark' });\n\nperformance.mark('test');\nperformance.mark('meow');\n```\n\n```cjs\nconst {\n  performance,\n  PerformanceObserver,\n} = require('node:perf_hooks');\n\nconst obs = new PerformanceObserver((perfObserverList, observer) => {\n  console.log(perfObserverList.getEntriesByType('mark'));\n  /**\n   * [\n   *   PerformanceEntry {\n   *     name: 'test',\n   *     entryType: 'mark',\n   *     startTime: 55.897834,\n   *     duration: 0,\n   *     detail: null\n   *   },\n   *   PerformanceEntry {\n   *     name: 'meow',\n   *     entryType: 'mark',\n   *     startTime: 56.350146,\n   *     duration: 0,\n   *     detail: null\n   *   }\n   * ]\n   */\n  performance.clearMarks();\n  performance.clearMeasures();\n  observer.disconnect();\n});\nobs.observe({ type: 'mark' });\n\nperformance.mark('test');\nperformance.mark('meow');\n```","summary":"Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime` whose `performanceEntry.entryType` is equal to `type`.","examples":[{"language":"mjs","displayName":null,"code":"import { performance, PerformanceObserver } from 'node:perf_hooks';\n\nconst obs = new PerformanceObserver((perfObserverList, observer) => {\n  console.log(perfObserverList.getEntriesByType('mark'));\n  /**\n   * [\n   *   PerformanceEntry {\n   *     name: 'test',\n   *     entryType: 'mark',\n   *     startTime: 55.897834,\n   *     duration: 0,\n   *     detail: null\n   *   },\n   *   PerformanceEntry {\n   *     name: 'meow',\n   *     entryType: 'mark',\n   *     startTime: 56.350146,\n   *     duration: 0,\n   *     detail: null\n   *   }\n   * ]\n   */\n  performance.clearMarks();\n  performance.clearMeasures();\n  observer.disconnect();\n});\nobs.observe({ type: 'mark' });\n\nperformance.mark('test');\nperformance.mark('meow');"},{"language":"cjs","displayName":null,"code":"const {\n  performance,\n  PerformanceObserver,\n} = require('node:perf_hooks');\n\nconst obs = new PerformanceObserver((perfObserverList, observer) => {\n  console.log(perfObserverList.getEntriesByType('mark'));\n  /**\n   * [\n   *   PerformanceEntry {\n   *     name: 'test',\n   *     entryType: 'mark',\n   *     startTime: 55.897834,\n   *     duration: 0,\n   *     detail: null\n   *   },\n   *   PerformanceEntry {\n   *     name: 'meow',\n   *     entryType: 'mark',\n   *     startTime: 56.350146,\n   *     duration: 0,\n   *     detail: null\n   *   }\n   * ]\n   */\n  performance.clearMarks();\n  performance.clearMeasures();\n  observer.disconnect();\n});\nobs.observe({ type: 'mark' });\n\nperformance.mark('test');\nperformance.mark('meow');"}],"children":[]}]},{"kind":"method","id":"perf_hookscreatehistogramoptions","name":"createHistogram","title":"`perf_hooks.createHistogram([options])`","scope":"module","overloadOf":null,"stability":null,"added":["v15.9.0","v14.18.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"lowest","type":{"text":"number | bigint","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6},{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":9,"end":15}]},"description":"The lowest discernible value. Must be an integer\nvalue greater than 0.","default":"1","optional":true,"rest":false,"properties":[]},{"name":"highest","type":{"text":"number | bigint","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6},{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":9,"end":15}]},"description":"The highest recordable value. Must be an integer\nvalue that is equal to or greater than two times `lowest`.","default":"Number.MAX_SAFE_INTEGER","optional":true,"rest":false,"properties":[]},{"name":"figures","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"The number of accuracy digits. Must be a number between\n`1` and `5`.","default":"3","optional":true,"rest":false,"properties":[]},{"name":"halfLife","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"The EWMA half-life in number of samples. When set to\na value greater than 0, the histogram tracks an exponentially weighted\nmoving average and standard deviation, accessible via\n`histogram.ewmaMean` and `histogram.ewmaStddev`. After `halfLife`\nrecordings, a value's influence has decayed to 50%.","default":"`0` (disabled)","optional":true,"rest":false,"properties":[]},{"name":"threshold","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"An SLO threshold value. When set together with\n`halfLife`, the histogram tracks a smoothed error rate for values\nexceeding this threshold, accessible via `histogram.ewmaErrorRate` and\n`histogram.burnRate()`.","default":"`0` (disabled)","optional":true,"rest":false,"properties":[]}]}],"returns":{"type":{"text":"RecordableHistogram","links":[{"name":"RecordableHistogram","href":"perf_hooks.html#class-recordablehistogram-extends-histogram","start":0,"end":19}]},"description":""}},"description":"Returns a {RecordableHistogram}.","summary":"Returns a {RecordableHistogram}.","examples":[],"children":[]},{"kind":"method","id":"perf_hookseventlooputilizationutilization1-utilization2","name":"eventLoopUtilization","title":"`perf_hooks.eventLoopUtilization([utilization1[, utilization2]])`","scope":"module","overloadOf":null,"stability":null,"added":["v25.2.0","v24.12.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"utilization1","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"The result of a previous call to\n`eventLoopUtilization()`.","default":null,"optional":true,"rest":false,"properties":[]},{"name":"utilization2","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"The result of a previous call to\n`eventLoopUtilization()` prior to `utilization1`.","default":null,"optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":""}},"description":"The `eventLoopUtilization()` function returns an object that contains the\ncumulative duration of time the event loop has been both idle and active as a\nhigh resolution milliseconds timer. The `utilization` value is the calculated\nEvent Loop Utilization (ELU).\n\nIf bootstrapping has not yet finished on the main thread the properties have\nthe value of `0`. The ELU is immediately available on [Worker threads](worker_threads.html#worker-threads) since\nbootstrap happens within the event loop.\n\nBoth `utilization1` and `utilization2` are optional parameters.\n\nIf `utilization1` is passed, then the delta between the current call's `active`\nand `idle` times, as well as the corresponding `utilization` value are\ncalculated and returned (similar to [`process.hrtime()`](process.html#processhrtimetime)).\n\nIf `utilization1` and `utilization2` are both passed, then the delta is\ncalculated between the two arguments. This is a convenience option because,\nunlike [`process.hrtime()`](process.html#processhrtimetime), calculating the ELU is more complex than a\nsingle subtraction.\n\nELU is similar to CPU utilization, except that it only measures event loop\nstatistics and not CPU usage. It represents the percentage of time the event\nloop has spent outside the event loop's event provider (e.g. `epoll_wait`).\nNo other CPU idle time is taken into consideration. The following is an example\nof how a mostly idle process will have a high ELU.\n\n```mjs\nimport { eventLoopUtilization } from 'node:perf_hooks';\nimport { spawnSync } from 'node:child_process';\n\nsetImmediate(() => {\n  const elu = eventLoopUtilization();\n  spawnSync('sleep', ['5']);\n  console.log(eventLoopUtilization(elu).utilization);\n});\n```\n\n```cjs\nconst { eventLoopUtilization } = require('node:perf_hooks');\nconst { spawnSync } = require('node:child_process');\n\nsetImmediate(() => {\n  const elu = eventLoopUtilization();\n  spawnSync('sleep', ['5']);\n  console.log(eventLoopUtilization(elu).utilization);\n});\n```\n\nAlthough the CPU is mostly idle while running this script, the value of\n`utilization` is `1`. This is because the call to\n[`child_process.spawnSync()`](child_process.html#child_processspawnsynccommand-args-options) blocks the event loop from proceeding.\n\nPassing in a user-defined object instead of the result of a previous call to\n`eventLoopUtilization()` will lead to undefined behavior. The return values\nare not guaranteed to reflect any correct state of the event loop.","summary":"The `eventLoopUtilization()` function 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. The `utilization` value is the calculated Event Loop Utilization (ELU).","examples":[{"language":"mjs","displayName":null,"code":"import { eventLoopUtilization } from 'node:perf_hooks';\nimport { spawnSync } from 'node:child_process';\n\nsetImmediate(() => {\n  const elu = eventLoopUtilization();\n  spawnSync('sleep', ['5']);\n  console.log(eventLoopUtilization(elu).utilization);\n});"},{"language":"cjs","displayName":null,"code":"const { eventLoopUtilization } = require('node:perf_hooks');\nconst { spawnSync } = require('node:child_process');\n\nsetImmediate(() => {\n  const elu = eventLoopUtilization();\n  spawnSync('sleep', ['5']);\n  console.log(eventLoopUtilization(elu).utilization);\n});"}],"children":[]},{"kind":"method","id":"perf_hooksmonitoreventloopdelayoptions","name":"monitorEventLoopDelay","title":"`perf_hooks.monitorEventLoopDelay([options])`","scope":"module","overloadOf":null,"stability":null,"added":["v11.10.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[{"versions":["v26.5.0"],"prUrl":"https://github.com/nodejs/node/pull/62935","commit":null,"description":"Added the `samplePerIteration` option."}],"signature":{"parameters":[{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"samplePerIteration","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"When `true`, samples are taken once per\nevent loop iteration.","default":"false","optional":true,"rest":false,"properties":[]},{"name":"resolution","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"The sampling rate in milliseconds for interval-based\nsampling. Must be greater than zero. This option is ignored when\n`samplePerIteration` is `true`.","default":"10","optional":true,"rest":false,"properties":[]}]}],"returns":{"type":{"text":"ELDHistogram","links":[{"name":"ELDHistogram","href":"perf_hooks.html#class-eldhistogram-extends-histogram","start":0,"end":12}]},"description":""}},"description":"*This property is an extension by Node.js. It is not available in Web browsers.*\n\nCreates a histogram object that samples and reports the event loop delay over\ntime. The delays will be reported in nanoseconds.\n\nBy default, the histogram is updated by a timer using the configured\n`resolution`. When `samplePerIteration` is `true`, samples are taken once per\nevent loop iteration using `uv_prepare_t` and `uv_check_t` hooks. In that mode,\nthe histogram does not keep the loop alive or force additional iterations when\nthe application is idle.\nThe two sampling modes produce significantly different results and should not\nbe compared directly.\n\n```mjs\nimport { monitorEventLoopDelay } from 'node:perf_hooks';\n\nconst h = monitorEventLoopDelay({ resolution: 20 });\nh.enable();\n// Do something.\nh.disable();\nconsole.log(h.min);\nconsole.log(h.max);\nconsole.log(h.mean);\nconsole.log(h.stddev);\nconsole.log(h.percentiles);\nconsole.log(h.percentile(50));\nconsole.log(h.percentile(99));\n```\n\n```cjs\nconst { monitorEventLoopDelay } = require('node:perf_hooks');\nconst h = monitorEventLoopDelay({ resolution: 20 });\nh.enable();\n// Do something.\nh.disable();\nconsole.log(h.min);\nconsole.log(h.max);\nconsole.log(h.mean);\nconsole.log(h.stddev);\nconsole.log(h.percentiles);\nconsole.log(h.percentile(50));\nconsole.log(h.percentile(99));\n```","summary":"_This property is an extension by Node.js. It is not available in Web browsers._","examples":[{"language":"mjs","displayName":null,"code":"import { monitorEventLoopDelay } from 'node:perf_hooks';\n\nconst h = monitorEventLoopDelay({ resolution: 20 });\nh.enable();\n// Do something.\nh.disable();\nconsole.log(h.min);\nconsole.log(h.max);\nconsole.log(h.mean);\nconsole.log(h.stddev);\nconsole.log(h.percentiles);\nconsole.log(h.percentile(50));\nconsole.log(h.percentile(99));"},{"language":"cjs","displayName":null,"code":"const { monitorEventLoopDelay } = require('node:perf_hooks');\nconst h = monitorEventLoopDelay({ resolution: 20 });\nh.enable();\n// Do something.\nh.disable();\nconsole.log(h.min);\nconsole.log(h.max);\nconsole.log(h.mean);\nconsole.log(h.stddev);\nconsole.log(h.percentiles);\nconsole.log(h.percentile(50));\nconsole.log(h.percentile(99));"}],"children":[]},{"kind":"method","id":"perf_hookstimerifyfn-options","name":"timerify","title":"`perf_hooks.timerify(fn[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v25.2.0","v24.12.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"fn","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"histogram","type":{"text":"RecordableHistogram","links":[{"name":"RecordableHistogram","href":"perf_hooks.html#class-recordablehistogram-extends-histogram","start":0,"end":19}]},"description":"A histogram object created using\n`perf_hooks.createHistogram()` that will record runtime durations in\nnanoseconds.","default":null,"optional":false,"rest":false,"properties":[]}]}],"returns":null},"description":"*This property is an extension by Node.js. It is not available in Web browsers.*\n\nWraps a function within a new function that measures the running time of the\nwrapped function. A `PerformanceObserver` must be subscribed to the `'function'`\nevent type in order for the timing details to be accessed.\n\n```mjs\nimport { timerify, performance, PerformanceObserver } from 'node:perf_hooks';\n\nfunction someFunction() {\n  console.log('hello world');\n}\n\nconst wrapped = timerify(someFunction);\n\nconst obs = new PerformanceObserver((list) => {\n  console.log(list.getEntries()[0].duration);\n\n  performance.clearMarks();\n  performance.clearMeasures();\n  obs.disconnect();\n});\nobs.observe({ entryTypes: ['function'] });\n\n// A performance timeline entry will be created\nwrapped();\n```\n\n```cjs\nconst {\n  timerify,\n  performance,\n  PerformanceObserver,\n} = require('node:perf_hooks');\n\nfunction someFunction() {\n  console.log('hello world');\n}\n\nconst wrapped = timerify(someFunction);\n\nconst obs = new PerformanceObserver((list) => {\n  console.log(list.getEntries()[0].duration);\n\n  performance.clearMarks();\n  performance.clearMeasures();\n  obs.disconnect();\n});\nobs.observe({ entryTypes: ['function'] });\n\n// A performance timeline entry will be created\nwrapped();\n```\n\nIf the wrapped function returns a promise, a finally handler will be attached\nto the promise and the duration will be reported once the finally handler is\ninvoked.","summary":"_This property is an extension by Node.js. It is not available in Web browsers._","examples":[{"language":"mjs","displayName":null,"code":"import { timerify, performance, PerformanceObserver } from 'node:perf_hooks';\n\nfunction someFunction() {\n  console.log('hello world');\n}\n\nconst wrapped = timerify(someFunction);\n\nconst obs = new PerformanceObserver((list) => {\n  console.log(list.getEntries()[0].duration);\n\n  performance.clearMarks();\n  performance.clearMeasures();\n  obs.disconnect();\n});\nobs.observe({ entryTypes: ['function'] });\n\n// A performance timeline entry will be created\nwrapped();"},{"language":"cjs","displayName":null,"code":"const {\n  timerify,\n  performance,\n  PerformanceObserver,\n} = require('node:perf_hooks');\n\nfunction someFunction() {\n  console.log('hello world');\n}\n\nconst wrapped = timerify(someFunction);\n\nconst obs = new PerformanceObserver((list) => {\n  console.log(list.getEntries()[0].duration);\n\n  performance.clearMarks();\n  performance.clearMeasures();\n  obs.disconnect();\n});\nobs.observe({ entryTypes: ['function'] });\n\n// A performance timeline entry will be created\nwrapped();"}],"children":[]},{"kind":"class","id":"class-histogram","name":"Histogram","title":"Class: `Histogram`","scope":"module","overloadOf":null,"stability":null,"added":["v11.10.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":null,"description":"","summary":"","examples":[],"children":[{"kind":"property","id":"histogramcount","name":"count","title":"`histogram.count`","scope":"module","overloadOf":null,"stability":null,"added":["v17.4.0","v16.14.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The number of samples recorded by the histogram.","summary":"The number of samples recorded by the histogram.","examples":[],"children":[]},{"kind":"property","id":"histogramcountbigint","name":"countBigInt","title":"`histogram.countBigInt`","scope":"module","overloadOf":null,"stability":null,"added":["v17.4.0","v16.14.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"bigint","links":[{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":0,"end":6}]},"default":null,"description":"The number of samples recorded by the histogram.","summary":"The number of samples recorded by the histogram.","examples":[],"children":[]},{"kind":"method","id":"histogramccdfvalue","name":"ccdf","title":"`histogram.ccdf(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"The value to query.","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"A probability between 0.0 and 1.0."}},"description":"Returns the complementary cumulative distribution function (CCDF) value\nfor the given value, representing the probability that a recorded value\nwill exceed `value`. Equivalent to `1 - histogram.cdf(value)`.","summary":"Returns the complementary cumulative distribution function (CCDF) value for the given value, representing the probability that a recorded value will exceed `value`. Equivalent to `1 - histogram.cdf(value)`.","examples":[],"children":[]},{"kind":"method","id":"histogramcdfvalue","name":"cdf","title":"`histogram.cdf(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"The value to query.","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"A probability between 0.0 and 1.0."}},"description":"Returns the cumulative distribution function (CDF) value for the given\nvalue, representing the probability that a recorded value will be less\nthan or equal to `value`. This is the inverse operation of\n`histogram.percentile()`.","summary":"Returns the cumulative distribution function (CDF) value for the given value, representing the probability that a recorded value will be less than or equal to `value`. This is the inverse operation of `histogram.percentile()`.","examples":[],"children":[]},{"kind":"method","id":"histogramcliffsdother","name":"cliffsD","title":"`histogram.cliffsD(other)`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"other","type":{"text":"Histogram","links":[{"name":"Histogram","href":"perf_hooks.html#class-histogram","start":0,"end":9}]},"description":"The histogram to compare against.","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"A value between -1.0 and 1.0."}},"description":"Computes [Cliff's delta](https://en.wikipedia.org/wiki/Effect_size#Cliff's_delta), a non-parametric effect size measure. Returns\nthe probability that a random value from this histogram exceeds a random\nvalue from `other`, minus the reverse probability. A value of 1 means every\nvalue in this histogram exceeds every value in `other`; -1 means the\nopposite; 0 means no tendency in either direction.","summary":"Computes Cliff's delta, a non-parametric effect size measure. Returns the probability that a random value from this histogram exceeds a random value from `other`, minus the reverse probability. A value of 1 means every value in this histogram exceeds every value in `other`; -1 means the opposite; 0 means no tendency in either direction.","examples":[],"children":[]},{"kind":"method","id":"histogramcohensdother","name":"cohensD","title":"`histogram.cohensD(other)`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"other","type":{"text":"Histogram","links":[{"name":"Histogram","href":"perf_hooks.html#class-histogram","start":0,"end":9}]},"description":"The histogram to compare against.","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"The effect size."}},"description":"Computes [Cohen's d](https://en.wikipedia.org/wiki/Effect_size#Cohen's_d) effect size, the standardized difference between the\nmeans of this histogram and `other`, using the pooled standard deviation.\nPositive values indicate this histogram has a higher mean. By convention,\n|d| < 0.2 is a small effect, 0.5 is medium, and 0.8 or greater is large.\nBoth histograms must have at least 2 recorded values; otherwise returns 0.","summary":"Computes Cohen's d effect size, the standardized difference between the means of this histogram and `other`, using the pooled standard deviation. Positive values indicate this histogram has a higher mean. By convention, |d| < 0.2 is a small effect, 0.5 is medium, and 0.8 or greater is large. Both histograms must have at least 2 recorded values; otherwise returns 0.","examples":[],"children":[]},{"kind":"method","id":"histogramcountatvalue","name":"countAt","title":"`histogram.countAt(value)`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"value","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"The value to query.","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":""}},"description":"Returns the number of recorded values that fall within the equivalent\nvalue range of the given value.","summary":"Returns the number of recorded values that fall within the equivalent value range of the given value.","examples":[],"children":[]},{"kind":"property","id":"histogramexceeds","name":"exceeds","title":"`histogram.exceeds`","scope":"module","overloadOf":null,"stability":null,"added":["v11.10.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The number of times the event loop delay exceeded the maximum 1 hour event\nloop delay threshold.","summary":"The number of times the event loop delay exceeded the maximum 1 hour event loop delay threshold.","examples":[],"children":[]},{"kind":"property","id":"histogramexceedsbigint","name":"exceedsBigInt","title":"`histogram.exceedsBigInt`","scope":"module","overloadOf":null,"stability":null,"added":["v17.4.0","v16.14.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"bigint","links":[{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":0,"end":6}]},"default":null,"description":"The number of times the event loop delay exceeded the maximum 1 hour event\nloop delay threshold.","summary":"The number of times the event loop delay exceeded the maximum 1 hour event loop delay threshold.","examples":[],"children":[]},{"kind":"property","id":"histogramewmamean","name":"ewmaMean","title":"`histogram.ewmaMean`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The exponentially weighted moving average of recorded values. Only active\nwhen the histogram was created with a `halfLife` option greater than 0.\nReturns `0` when EWMA is disabled or no values have been recorded.","summary":"The exponentially weighted moving average of recorded values. Only active when the histogram was created with a `halfLife` option greater than 0. Returns `0` when EWMA is disabled or no values have been recorded.","examples":[],"children":[]},{"kind":"property","id":"histogramewmastddev","name":"ewmaStddev","title":"`histogram.ewmaStddev`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The exponentially weighted moving standard deviation. Only active when the\nhistogram was created with a `halfLife` option greater than 0. Returns `0`\nwhen EWMA is disabled or no values have been recorded.","summary":"The exponentially weighted moving standard deviation. Only active when the histogram was created with a `halfLife` option greater than 0. Returns `0` when EWMA is disabled or no values have been recorded.","examples":[],"children":[]},{"kind":"property","id":"histogramewmaerrorrate","name":"ewmaErrorRate","title":"`histogram.ewmaErrorRate`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The EWMA-smoothed probability of a recorded value exceeding the configured\n`threshold`. Only active when the histogram was created with both `halfLife`\nand `threshold` options. Returns `0` when not enabled or no values have been\nrecorded.","summary":"The EWMA-smoothed probability of a recorded value exceeding the configured `threshold`. Only active when the histogram was created with both `halfLife` and `threshold` options. Returns `0` when not enabled or no values have been recorded.","examples":[],"children":[]},{"kind":"method","id":"histogramburnrateslotarget","name":"burnRate","title":"`histogram.burnRate(sloTarget)`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"sloTarget","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"The SLO target as a fraction between 0 and 1\n(exclusive). For example, `0.999` for a 99.9% SLO.","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":""}},"description":"Returns the SLO burn rate: `ewmaErrorRate / (1 - sloTarget)`. A burn rate\nof 1 means the error budget will be exactly exhausted over the SLO window.\nA burn rate greater than 1 means it is being consumed faster than allowed.\nRequires the histogram to have been created with both `halfLife` and\n`threshold` options.\n\n```js\nconst { createHistogram } = require('node:perf_hooks');\n\n// Track latency with a 200ms SLO threshold, half-life of 100 samples\nconst h = createHistogram({ halfLife: 100, threshold: 200_000_000 });\n\n// ... record latency values ...\n\n// Check burn rate against a 99.9% SLO\nconst rate = h.burnRate(0.999);\nif (rate > 1) {\n  console.log(`SLO burn rate: ${rate.toFixed(2)}x — error budget depleting`);\n}\n```","summary":"Returns the SLO burn rate: `ewmaErrorRate / (1 - sloTarget)`. A burn rate of 1 means the error budget will be exactly exhausted over the SLO window. A burn rate greater than 1 means it is being consumed faster than allowed. Requires the histogram to have been created with both `halfLife` and `threshold` options.","examples":[{"language":"js","displayName":null,"code":"const { createHistogram } = require('node:perf_hooks');\n\n// Track latency with a 200ms SLO threshold, half-life of 100 samples\nconst h = createHistogram({ halfLife: 100, threshold: 200_000_000 });\n\n// ... record latency values ...\n\n// Check burn rate against a 99.9% SLO\nconst rate = h.burnRate(0.999);\nif (rate > 1) {\n  console.log(`SLO burn rate: ${rate.toFixed(2)}x — error budget depleting`);\n}"}],"children":[]},{"kind":"method","id":"histogramkstestother","name":"ksTest","title":"`histogram.ksTest(other)`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"other","type":{"text":"Histogram","links":[{"name":"Histogram","href":"perf_hooks.html#class-histogram","start":0,"end":9}]},"description":"The histogram to compare against.","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"The KS D-statistic, between 0.0 and 1.0."}},"description":"Computes the Kolmogorov-Smirnov test statistic comparing this histogram's\ndistribution to `other`. A value of 0 indicates identical distributions;\nvalues close to 1 indicate completely disjoint distributions. Useful for\ndetecting performance regressions by comparing before/after histograms.","summary":"Computes the Kolmogorov-Smirnov test statistic comparing this histogram's distribution to `other`. A value of 0 indicates identical distributions; values close to 1 indicate completely disjoint distributions. Useful for detecting performance regressions by comparing before/after histograms.","examples":[],"children":[]},{"kind":"property","id":"histogramkurtosis","name":"kurtosis","title":"`histogram.kurtosis`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The excess kurtosis of the recorded values. Measures the heaviness of the\ndistribution's tails relative to a normal distribution. Positive values\nindicate heavier tails (more extreme outliers); negative values indicate\nlighter tails.","summary":"The excess kurtosis of the recorded values. Measures the heaviness of the distribution's tails relative to a normal distribution. Positive values indicate heavier tails (more extreme outliers); negative values indicate lighter tails.","examples":[],"children":[]},{"kind":"method","id":"histogramlinearbucketsstepsize","name":"linearBuckets","title":"`histogram.linearBuckets(stepSize)`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"stepSize","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"The width of each linear bucket.","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"Map","links":[{"name":"Map","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map","start":0,"end":3}]},"description":"A map of bucket boundary values to counts."}},"description":"Returns the histogram data rebucketed into linearly-spaced intervals\nof `stepSize`. Useful for visualization and export.","summary":"Returns the histogram data rebucketed into linearly-spaced intervals of `stepSize`. Useful for visualization and export.","examples":[],"children":[]},{"kind":"method","id":"histogramlogbucketsfirstbucket-base","name":"logBuckets","title":"`histogram.logBuckets(firstBucket, base)`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"firstBucket","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"The value of the first bucket boundary.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"base","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"The logarithmic base for bucket width growth. Must be > 1.","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"Map","links":[{"name":"Map","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map","start":0,"end":3}]},"description":"A map of bucket boundary values to counts."}},"description":"Returns the histogram data rebucketed into logarithmically-spaced\nintervals, where each bucket's width is multiplied by `base`.\nUseful for visualization and export.","summary":"Returns the histogram data rebucketed into logarithmically-spaced intervals, where each bucket's width is multiplied by `base`. Useful for visualization and export.","examples":[],"children":[]},{"kind":"method","id":"histogrammannwhitneytestother","name":"mannWhitneyTest","title":"`histogram.mannWhitneyTest(other)`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"other","type":{"text":"Histogram","links":[{"name":"Histogram","href":"perf_hooks.html#class-histogram","start":0,"end":9}]},"description":"The histogram to compare against.","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":""}},"description":"Performs a [Mann-Whitney U test](https://en.wikipedia.org/wiki/Mann%E2%80%93Whitney_U_test) comparing whether this histogram tends to\nproduce larger or smaller values than `other`. Unlike `welchTest()`, this is a\nnon-parametric test that makes no assumptions about the shape of the\ndistributions. Uses the normal approximation with tie correction for the\np-value.","summary":"Performs a Mann-Whitney U test comparing whether this histogram tends to produce larger or smaller values than `other`. Unlike `welchTest()`, this is a non-parametric test that makes no assumptions about the shape of the distributions. Uses the normal approximation with tie correction for the p-value.","examples":[],"children":[]},{"kind":"property","id":"histogrammax","name":"max","title":"`histogram.max`","scope":"module","overloadOf":null,"stability":null,"added":["v11.10.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The maximum recorded event loop delay.","summary":"The maximum recorded event loop delay.","examples":[],"children":[]},{"kind":"property","id":"histogrammaxbigint","name":"maxBigInt","title":"`histogram.maxBigInt`","scope":"module","overloadOf":null,"stability":null,"added":["v17.4.0","v16.14.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"bigint","links":[{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":0,"end":6}]},"default":null,"description":"The maximum recorded event loop delay.","summary":"The maximum recorded event loop delay.","examples":[],"children":[]},{"kind":"property","id":"histogrammean","name":"mean","title":"`histogram.mean`","scope":"module","overloadOf":null,"stability":null,"added":["v11.10.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The mean of the recorded event loop delays.","summary":"The mean of the recorded event loop delays.","examples":[],"children":[]},{"kind":"property","id":"histogrammin","name":"min","title":"`histogram.min`","scope":"module","overloadOf":null,"stability":null,"added":["v11.10.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The minimum recorded event loop delay.","summary":"The minimum recorded event loop delay.","examples":[],"children":[]},{"kind":"property","id":"histogramminbigint","name":"minBigInt","title":"`histogram.minBigInt`","scope":"module","overloadOf":null,"stability":null,"added":["v17.4.0","v16.14.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"bigint","links":[{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":0,"end":6}]},"default":null,"description":"The minimum recorded event loop delay.","summary":"The minimum recorded event loop delay.","examples":[],"children":[]},{"kind":"method","id":"histogrampercentilepercentile","name":"percentile","title":"`histogram.percentile(percentile)`","scope":"module","overloadOf":null,"stability":null,"added":["v11.10.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"percentile","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"A percentile value in the range (0, 100].","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":""}},"description":"Returns the value at the given percentile.","summary":"Returns the value at the given percentile.","examples":[],"children":[]},{"kind":"method","id":"histogrampercentilebigintpercentile","name":"percentileBigInt","title":"`histogram.percentileBigInt(percentile)`","scope":"module","overloadOf":null,"stability":null,"added":["v17.4.0","v16.14.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"percentile","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"A percentile value in the range (0, 100].","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"bigint","links":[{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":0,"end":6}]},"description":""}},"description":"Returns the value at the given percentile.","summary":"Returns the value at the given percentile.","examples":[],"children":[]},{"kind":"method","id":"histogrampercentilecipercentile-options","name":"percentileCI","title":"`histogram.percentileCI(percentile[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"percentile","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"A percentile value in the range (0, 100].","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"confidence","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"The confidence level for the interval, between\n0 and 1 (exclusive).","default":"0.95","optional":true,"rest":false,"properties":[]}]}],"returns":{"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":""}},"description":"Returns a confidence interval for the given percentile using the exact\nbinomial method. With fewer samples, the interval will be wider, reflecting\nthe greater uncertainty in the percentile estimate. Requires at least 2\nrecorded values; with fewer than 2, `lower` and `upper` will equal `value`.\n\n```js\nconst { createHistogram } = require('node:perf_hooks');\n\nconst h = createHistogram();\nfor (let i = 0; i < 1000; i++) {\n  h.record(Math.floor(Math.random() * 100));\n}\n\nconst ci = h.percentileCI(99);\nconsole.log(ci.value);  // The p99 point estimate\nconsole.log(ci.lower);  // The lower bound (95% confidence)\nconsole.log(ci.upper);  // The upper bound (95% confidence)\n```","summary":"Returns a confidence interval for the given percentile using the exact binomial method. With fewer samples, the interval will be wider, reflecting the greater uncertainty in the percentile estimate. Requires at least 2 recorded values; with fewer than 2, `lower` and `upper` will equal `value`.","examples":[{"language":"js","displayName":null,"code":"const { createHistogram } = require('node:perf_hooks');\n\nconst h = createHistogram();\nfor (let i = 0; i < 1000; i++) {\n  h.record(Math.floor(Math.random() * 100));\n}\n\nconst ci = h.percentileCI(99);\nconsole.log(ci.value);  // The p99 point estimate\nconsole.log(ci.lower);  // The lower bound (95% confidence)\nconsole.log(ci.upper);  // The upper bound (95% confidence)"}],"children":[]},{"kind":"property","id":"histogrampercentiles","name":"percentiles","title":"`histogram.percentiles`","scope":"module","overloadOf":null,"stability":null,"added":["v11.10.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"Map","links":[{"name":"Map","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map","start":0,"end":3}]},"default":null,"description":"Returns a `Map` object detailing the accumulated percentile distribution.","summary":"Returns a `Map` object detailing the accumulated percentile distribution.","examples":[],"children":[]},{"kind":"property","id":"histogrampercentilesbigint","name":"percentilesBigInt","title":"`histogram.percentilesBigInt`","scope":"module","overloadOf":null,"stability":null,"added":["v17.4.0","v16.14.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"Map","links":[{"name":"Map","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map","start":0,"end":3}]},"default":null,"description":"Returns a `Map` object detailing the accumulated percentile distribution.","summary":"Returns a `Map` object detailing the accumulated percentile distribution.","examples":[],"children":[]},{"kind":"method","id":"histogrampercentilesatpercentiles","name":"percentilesAt","title":"`histogram.percentilesAt(percentiles)`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"percentiles","type":{"text":"number[]","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"An array of percentile values in the range (0, 100].","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"Map","links":[{"name":"Map","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map","start":0,"end":3}]},"description":"A map of percentile values to their corresponding histogram\nvalues."}},"description":"Returns the values at the specified percentiles, computed in a single\nefficient pass over the histogram data. More efficient than calling\n`histogram.percentile()` multiple times.","summary":"Returns the values at the specified percentiles, computed in a single efficient pass over the histogram data. More efficient than calling `histogram.percentile()` multiple times.","examples":[],"children":[]},{"kind":"method","id":"histogramreset","name":"reset","title":"`histogram.reset()`","scope":"module","overloadOf":null,"stability":null,"added":["v11.10.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"Resets the collected histogram data.","summary":"Resets the collected histogram data.","examples":[],"children":[]},{"kind":"property","id":"histogramskewness","name":"skewness","title":"`histogram.skewness`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The skewness of the recorded values. Measures the asymmetry of the\ndistribution. A positive value indicates a right-skewed distribution\n(longer right tail, common for latency data); a negative value\nindicates a left-skewed distribution.","summary":"The skewness of the recorded values. Measures the asymmetry of the distribution. A positive value indicates a right-skewed distribution (longer right tail, common for latency data); a negative value indicates a left-skewed distribution.","examples":[],"children":[]},{"kind":"property","id":"histogramstddev","name":"stddev","title":"`histogram.stddev`","scope":"module","overloadOf":null,"stability":null,"added":["v11.10.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"default":null,"description":"The standard deviation of the recorded event loop delays.","summary":"The standard deviation of the recorded event loop delays.","examples":[],"children":[]},{"kind":"method","id":"histogramwelchtestother-options","name":"welchTest","title":"`histogram.welchTest(other[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"other","type":{"text":"Histogram","links":[{"name":"Histogram","href":"perf_hooks.html#class-histogram","start":0,"end":9}]},"description":"The histogram to compare against.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"confidence","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Confidence level for the interval, between 0 and 1.","default":"0.95","optional":true,"rest":false,"properties":[]}]}],"returns":{"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":""}},"description":"Performs [Welch's t-test](https://en.wikipedia.org/wiki/Welch%27s_t-test) comparing the means of this histogram and `other`.\nThe p-value indicates the probability of observing a difference at least this\nextreme under the null hypothesis that the two distributions have the same\nmean. Both histograms must have at least 2 recorded values; otherwise the\nresult has `pValue` 1 and `tStatistic` 0.","summary":"Performs Welch's t-test comparing the means of this histogram and `other`. The p-value indicates the probability of observing a difference at least this extreme under the null hypothesis that the two distributions have the same mean. Both histograms must have at least 2 recorded values; otherwise the result has `pValue` 1 and `tStatistic` 0.","examples":[],"children":[]}]},{"kind":"class","id":"class-eldhistogram-extends-histogram","name":"ELDHistogram","title":"Class: `ELDHistogram extends Histogram`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":{"text":"Histogram","links":[]},"description":"A `Histogram` that records event loop delay, returned by\n[`perf_hooks.monitorEventLoopDelay()`](#perf_hooksmonitoreventloopdelayoptions).","summary":"A `Histogram` that records event loop delay, returned by `perf_hooks.monitorEventLoopDelay()`.","examples":[],"children":[{"kind":"method","id":"histogramdisable","name":"disable","title":"`histogram.disable()`","scope":"module","overloadOf":null,"stability":null,"added":["v11.10.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Disables event loop delay sampling. Returns `true` if sampling was\nstopped, `false` if it was already stopped.","summary":"Disables event loop delay sampling. Returns `true` if sampling was stopped, `false` if it was already stopped.","examples":[],"children":[]},{"kind":"method","id":"histogramenable","name":"enable","title":"`histogram.enable()`","scope":"module","overloadOf":null,"stability":null,"added":["v11.10.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":""}},"description":"Enables event loop delay sampling. Returns `true` if sampling was\nstarted, `false` if it was already started.","summary":"Enables event loop delay sampling. Returns `true` if sampling was started, `false` if it was already started.","examples":[],"children":[]},{"kind":"method","id":"histogramsymboldispose","name":"[Symbol.dispose]","title":"`histogram[Symbol.dispose]()`","scope":"module","overloadOf":null,"stability":null,"added":["v24.2.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"Disables event loop delay sampling when the histogram is disposed.\n\n```js\nconst { monitorEventLoopDelay } = require('node:perf_hooks');\n{\n  using hist = monitorEventLoopDelay({ resolution: 20 });\n  hist.enable();\n  // The histogram will be disabled when the block is exited.\n}\n```","summary":"Disables event loop delay sampling when the histogram is disposed.","examples":[{"language":"js","displayName":null,"code":"const { monitorEventLoopDelay } = require('node:perf_hooks');\n{\n  using hist = monitorEventLoopDelay({ resolution: 20 });\n  hist.enable();\n  // The histogram will be disabled when the block is exited.\n}"}],"children":[]},{"kind":"section","id":"cloning-an-eldhistogram","name":"Cloning an ELDHistogram","title":"Cloning an `ELDHistogram`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"{ELDHistogram} instances can be cloned via {MessagePort}. On the receiving end,\nthe histogram is cloned as a plain {Histogram} object that does not implement\nthe `enable()` and `disable()` methods.","summary":"{ELDHistogram} instances can be cloned via {MessagePort}. On the receiving end, the histogram is cloned as a plain {Histogram} object that does not implement the `enable()` and `disable()` methods.","examples":[],"children":[]}]},{"kind":"class","id":"class-recordablehistogram-extends-histogram","name":"RecordableHistogram","title":"Class: `RecordableHistogram extends Histogram`","scope":"module","overloadOf":null,"stability":null,"added":["v15.9.0","v14.18.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":{"text":"Histogram","links":[]},"description":"","summary":"","examples":[],"children":[{"kind":"method","id":"histogramaddother","name":"add","title":"`histogram.add(other)`","scope":"module","overloadOf":null,"stability":null,"added":["v17.4.0","v16.14.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"other","type":{"text":"RecordableHistogram","links":[{"name":"RecordableHistogram","href":"perf_hooks.html#class-recordablehistogram-extends-histogram","start":0,"end":19}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"Adds the values from `other` to this histogram.","summary":"Adds the values from `other` to this histogram.","examples":[],"children":[]},{"kind":"method","id":"histogramrecordval","name":"record","title":"`histogram.record(val)`","scope":"module","overloadOf":null,"stability":null,"added":["v15.9.0","v14.18.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"val","type":{"text":"number | bigint","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6},{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":9,"end":15}]},"description":"The amount to record in the histogram.","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"","summary":"","examples":[],"children":[]},{"kind":"method","id":"histogramrecorddelta","name":"recordDelta","title":"`histogram.recordDelta()`","scope":"module","overloadOf":null,"stability":null,"added":["v15.9.0","v14.18.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"Calculates the amount of time (in nanoseconds) that has passed since the\nprevious call to `recordDelta()` and records that amount in the histogram.","summary":"Calculates the amount of time (in nanoseconds) that has passed since the previous call to `recordDelta()` and records that amount in the histogram.","examples":[],"children":[]},{"kind":"method","id":"histogramrecordcorrectedval-expectedinterval","name":"recordCorrected","title":"`histogram.recordCorrected(val, expectedInterval)`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"val","type":{"text":"number | bigint","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6},{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":9,"end":15}]},"description":"The value to record.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"expectedInterval","type":{"text":"number | bigint","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6},{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":9,"end":15}]},"description":"The expected recording interval.","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"Records a value with coordinated omission correction. When a system stall\nprevents timely recording, this method backfills intermediate values at\n`expectedInterval` steps between the previously recorded value and `val`.\nThis compensates for measurement gaps that would otherwise underrepresent\nlatency.","summary":"Records a value with coordinated omission correction. When a system stall prevents timely recording, this method backfills intermediate values at `expectedInterval` steps between the previously recorded value and `val`. This compensates for measurement gaps that would otherwise underrepresent latency.","examples":[],"children":[]},{"kind":"method","id":"histogramsubtractother","name":"subtract","title":"`histogram.subtract(other)`","scope":"module","overloadOf":null,"stability":null,"added":["v26.8.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"other","type":{"text":"RecordableHistogram","links":[{"name":"RecordableHistogram","href":"perf_hooks.html#class-recordablehistogram-extends-histogram","start":0,"end":19}]},"description":"","default":null,"optional":false,"rest":false,"properties":[]}],"returns":null},"description":"Subtracts the values of `other` from this histogram. Both histograms should\nhave compatible configurations. Bucket counts that would become negative\nare clamped to zero.","summary":"Subtracts the values of `other` from this histogram. Both histograms should have compatible configurations. Bucket counts that would become negative are clamped to zero.","examples":[],"children":[]}]},{"kind":"section","id":"histogram-analysis-examples","name":"Histogram analysis examples","title":"Histogram analysis examples","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"The `Histogram` class provides statistical analysis methods useful for\nperformance monitoring, SLO enforcement, and regression detection.","summary":"The `Histogram` class provides statistical analysis methods useful for performance monitoring, SLO enforcement, and regression detection.","examples":[],"children":[{"kind":"section","id":"distribution-shape-analysis","name":"Distribution shape analysis","title":"Distribution shape analysis","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"```js\nconst { createHistogram } = require('node:perf_hooks');\n\nconst h = createHistogram();\n\n// Simulate a right-skewed latency distribution\nfor (let i = 0; i < 1000; i++) {\n  h.record(Math.ceil(Math.random() * 100));\n}\n// Add some outliers\nfor (let i = 0; i < 10; i++) {\n  h.record(500 + Math.ceil(Math.random() * 500));\n}\n\nconsole.log('Skewness:', h.skewness.toFixed(4));  // Positive = right-skewed\nconsole.log('Kurtosis:', h.kurtosis.toFixed(4));  // Positive = heavy tails\n```","summary":"","examples":[{"language":"js","displayName":null,"code":"const { createHistogram } = require('node:perf_hooks');\n\nconst h = createHistogram();\n\n// Simulate a right-skewed latency distribution\nfor (let i = 0; i < 1000; i++) {\n  h.record(Math.ceil(Math.random() * 100));\n}\n// Add some outliers\nfor (let i = 0; i < 10; i++) {\n  h.record(500 + Math.ceil(Math.random() * 500));\n}\n\nconsole.log('Skewness:', h.skewness.toFixed(4));  // Positive = right-skewed\nconsole.log('Kurtosis:', h.kurtosis.toFixed(4));  // Positive = heavy tails"}],"children":[]},{"kind":"section","id":"slo-monitoring-with-cdf","name":"SLO monitoring with CDF","title":"SLO monitoring with CDF","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"```js\nconst { createHistogram } = require('node:perf_hooks');\n\nconst latency = createHistogram();\n\n// Record request latencies (in nanoseconds)...\n\n// \"What fraction of requests complete within 100ms?\"\nconst withinSLO = latency.cdf(100_000_000);\nconsole.log(`${(withinSLO * 100).toFixed(1)}% of requests within SLO`);\n\n// \"What fraction of requests exceed 500ms?\"\nconst violating = latency.ccdf(500_000_000);\nconsole.log(`${(violating * 100).toFixed(1)}% of requests violating SLO`);\n```","summary":"","examples":[{"language":"js","displayName":null,"code":"const { createHistogram } = require('node:perf_hooks');\n\nconst latency = createHistogram();\n\n// Record request latencies (in nanoseconds)...\n\n// \"What fraction of requests complete within 100ms?\"\nconst withinSLO = latency.cdf(100_000_000);\nconsole.log(`${(withinSLO * 100).toFixed(1)}% of requests within SLO`);\n\n// \"What fraction of requests exceed 500ms?\"\nconst violating = latency.ccdf(500_000_000);\nconsole.log(`${(violating * 100).toFixed(1)}% of requests violating SLO`);"}],"children":[]},{"kind":"section","id":"slo-burn-rate-monitoring","name":"SLO burn rate monitoring","title":"SLO burn rate monitoring","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"```js\nconst { createHistogram } = require('node:perf_hooks');\n\n// Track latency with EWMA (half-life 100 samples) and a 200ms SLO threshold\nconst latency = createHistogram({\n  halfLife: 100,\n  threshold: 200_000_000,  // 200ms in nanoseconds\n});\n\n// Record request latencies...\n\n// Smoothed error rate: probability of exceeding the threshold\nconsole.log(`Error rate: ${(latency.ewmaErrorRate * 100).toFixed(2)}%`);\n\n// Burn rate against a 99.9% SLO\n// >1 means the error budget is depleting faster than allowed\nconst rate = latency.burnRate(0.999);\nconsole.log(`Burn rate: ${rate.toFixed(2)}x`);\n\n// EWMA mean and stddev track the smoothed latency\nconsole.log(`EWMA latency: ${latency.ewmaMean.toFixed(0)}ns`);\nconsole.log(`EWMA stddev:  ${latency.ewmaStddev.toFixed(0)}ns`);\n```","summary":"","examples":[{"language":"js","displayName":null,"code":"const { createHistogram } = require('node:perf_hooks');\n\n// Track latency with EWMA (half-life 100 samples) and a 200ms SLO threshold\nconst latency = createHistogram({\n  halfLife: 100,\n  threshold: 200_000_000,  // 200ms in nanoseconds\n});\n\n// Record request latencies...\n\n// Smoothed error rate: probability of exceeding the threshold\nconsole.log(`Error rate: ${(latency.ewmaErrorRate * 100).toFixed(2)}%`);\n\n// Burn rate against a 99.9% SLO\n// >1 means the error budget is depleting faster than allowed\nconst rate = latency.burnRate(0.999);\nconsole.log(`Burn rate: ${rate.toFixed(2)}x`);\n\n// EWMA mean and stddev track the smoothed latency\nconsole.log(`EWMA latency: ${latency.ewmaMean.toFixed(0)}ns`);\nconsole.log(`EWMA stddev:  ${latency.ewmaStddev.toFixed(0)}ns`);"}],"children":[]},{"kind":"section","id":"regression-detection-with-ks-test","name":"Regression detection with KS test","title":"Regression detection with KS test","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"```js\nconst { createHistogram } = require('node:perf_hooks');\n\nconst baseline = createHistogram();\nconst current = createHistogram();\n\n// Record baseline and current latencies...\n\n// D-statistic: 0 = identical, 1 = completely different\nconst d = baseline.ksTest(current);\nif (d > 0.1) {\n  console.log(`Possible regression detected (D=${d.toFixed(4)})`);\n}\n```","summary":"","examples":[{"language":"js","displayName":null,"code":"const { createHistogram } = require('node:perf_hooks');\n\nconst baseline = createHistogram();\nconst current = createHistogram();\n\n// Record baseline and current latencies...\n\n// D-statistic: 0 = identical, 1 = completely different\nconst d = baseline.ksTest(current);\nif (d > 0.1) {\n  console.log(`Possible regression detected (D=${d.toFixed(4)})`);\n}"}],"children":[]},{"kind":"section","id":"batch-percentile-queries","name":"Batch percentile queries","title":"Batch percentile queries","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"```js\nconst { createHistogram } = require('node:perf_hooks');\n\nconst h = createHistogram();\n// Record values...\n\n// Efficiently query common monitoring percentiles in one pass\nconst p = h.percentilesAt([50, 75, 90, 95, 99, 99.9]);\nconsole.log('p50:', p.get(50));\nconsole.log('p99:', p.get(99));\n```","summary":"","examples":[{"language":"js","displayName":null,"code":"const { createHistogram } = require('node:perf_hooks');\n\nconst h = createHistogram();\n// Record values...\n\n// Efficiently query common monitoring percentiles in one pass\nconst p = h.percentilesAt([50, 75, 90, 95, 99, 99.9]);\nconsole.log('p50:', p.get(50));\nconsole.log('p99:', p.get(99));"}],"children":[]},{"kind":"section","id":"snapshot-diffing-with-subtract","name":"Snapshot diffing with subtract","title":"Snapshot diffing with subtract","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"```js\nconst { createHistogram } = require('node:perf_hooks');\n\nconst total = createHistogram();\nconst snapshot = createHistogram();\n\n// Record values into total...\n// Periodically snapshot for \"last interval\" analysis:\nsnapshot.add(total);\n\n// Later, take a new snapshot and diff:\nconst newSnapshot = createHistogram();\nnewSnapshot.add(total);\nnewSnapshot.subtract(snapshot);\n// newSnapshot now contains only the values recorded since the last snapshot\nconsole.log('Recent p99:', newSnapshot.percentile(99));\n```","summary":"","examples":[{"language":"js","displayName":null,"code":"const { createHistogram } = require('node:perf_hooks');\n\nconst total = createHistogram();\nconst snapshot = createHistogram();\n\n// Record values into total...\n// Periodically snapshot for \"last interval\" analysis:\nsnapshot.add(total);\n\n// Later, take a new snapshot and diff:\nconst newSnapshot = createHistogram();\nnewSnapshot.add(total);\nnewSnapshot.subtract(snapshot);\n// newSnapshot now contains only the values recorded since the last snapshot\nconsole.log('Recent p99:', newSnapshot.percentile(99));"}],"children":[]},{"kind":"section","id":"benchmark-comparison-with-welchs-t-test","name":"Benchmark comparison with Welch's t-test","title":"Benchmark comparison with Welch's t-test","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"```js\nconst { createHistogram } = require('node:perf_hooks');\n\nconst baseline = createHistogram();\nconst candidate = createHistogram();\n\n// Record operation rates from the old and new builds...\n\nconst result = baseline.welchTest(candidate);\nconst improvement = ((candidate.mean - baseline.mean) / baseline.mean * 100);\n\nconsole.log(`Improvement: ${improvement.toFixed(2)}%`);\nconsole.log(`p-value: ${result.pValue.toFixed(6)}`);\nconsole.log(`95% CI: [${result.confidenceInterval.lower.toFixed(2)}, ` +\n            `${result.confidenceInterval.upper.toFixed(2)}]`);\n\nif (result.pValue < 0.05) {\n  const d = baseline.cohensD(candidate);\n  console.log(`Statistically significant (Cohen's d = ${d.toFixed(4)})`);\n}\n```","summary":"","examples":[{"language":"js","displayName":null,"code":"const { createHistogram } = require('node:perf_hooks');\n\nconst baseline = createHistogram();\nconst candidate = createHistogram();\n\n// Record operation rates from the old and new builds...\n\nconst result = baseline.welchTest(candidate);\nconst improvement = ((candidate.mean - baseline.mean) / baseline.mean * 100);\n\nconsole.log(`Improvement: ${improvement.toFixed(2)}%`);\nconsole.log(`p-value: ${result.pValue.toFixed(6)}`);\nconsole.log(`95% CI: [${result.confidenceInterval.lower.toFixed(2)}, ` +\n            `${result.confidenceInterval.upper.toFixed(2)}]`);\n\nif (result.pValue < 0.05) {\n  const d = baseline.cohensD(candidate);\n  console.log(`Statistically significant (Cohen's d = ${d.toFixed(4)})`);\n}"}],"children":[]},{"kind":"section","id":"effect-size-with-cliffs-delta","name":"Effect size with Cliff's delta","title":"Effect size with Cliff's delta","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"```js\nconst { createHistogram } = require('node:perf_hooks');\n\nconst before = createHistogram();\nconst after = createHistogram();\n\n// Record latencies before and after a change...\n\nconst delta = before.cliffsD(after);\n// A delta > 0: before tends to produce larger values (improvement)\n// A delta < 0: after tends to produce larger values (regression)\nconsole.log(`Cliff's delta: ${delta.toFixed(4)}`);\n```","summary":"","examples":[{"language":"js","displayName":null,"code":"const { createHistogram } = require('node:perf_hooks');\n\nconst before = createHistogram();\nconst after = createHistogram();\n\n// Record latencies before and after a change...\n\nconst delta = before.cliffsD(after);\n// A delta > 0: before tends to produce larger values (improvement)\n// A delta < 0: after tends to produce larger values (regression)\nconsole.log(`Cliff's delta: ${delta.toFixed(4)}`);"}],"children":[]}]},{"kind":"section","id":"examples","name":"Examples","title":"Examples","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"","summary":"","examples":[],"children":[{"kind":"section","id":"measuring-the-duration-of-async-operations","name":"Measuring the duration of async operations","title":"Measuring the duration of async operations","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"The following example uses the [Async Hooks](async_hooks.html) and Performance APIs to measure\nthe actual duration of a Timeout operation (including the amount of time it took\nto execute the callback).\n\n```mjs\nimport { createHook } from 'node:async_hooks';\nimport { performance, PerformanceObserver } from 'node:perf_hooks';\n\nconst set = new Set();\nconst hook = createHook({\n  init(id, type) {\n    if (type === 'Timeout') {\n      performance.mark(`Timeout-${id}-Init`);\n      set.add(id);\n    }\n  },\n  destroy(id) {\n    if (set.has(id)) {\n      set.delete(id);\n      performance.mark(`Timeout-${id}-Destroy`);\n      performance.measure(`Timeout-${id}`,\n                          `Timeout-${id}-Init`,\n                          `Timeout-${id}-Destroy`);\n    }\n  },\n});\nhook.enable();\n\nconst obs = new PerformanceObserver((list, observer) => {\n  console.log(list.getEntries()[0]);\n  performance.clearMarks();\n  performance.clearMeasures();\n  observer.disconnect();\n});\nobs.observe({ entryTypes: ['measure'], buffered: true });\n\nsetTimeout(() => {}, 1000);\n```\n\n```cjs\nconst async_hooks = require('node:async_hooks');\nconst {\n  performance,\n  PerformanceObserver,\n} = require('node:perf_hooks');\n\nconst set = new Set();\nconst hook = async_hooks.createHook({\n  init(id, type) {\n    if (type === 'Timeout') {\n      performance.mark(`Timeout-${id}-Init`);\n      set.add(id);\n    }\n  },\n  destroy(id) {\n    if (set.has(id)) {\n      set.delete(id);\n      performance.mark(`Timeout-${id}-Destroy`);\n      performance.measure(`Timeout-${id}`,\n                          `Timeout-${id}-Init`,\n                          `Timeout-${id}-Destroy`);\n    }\n  },\n});\nhook.enable();\n\nconst obs = new PerformanceObserver((list, observer) => {\n  console.log(list.getEntries()[0]);\n  performance.clearMarks();\n  performance.clearMeasures();\n  observer.disconnect();\n});\nobs.observe({ entryTypes: ['measure'] });\n\nsetTimeout(() => {}, 1000);\n```","summary":"The following example uses the Async Hooks and Performance APIs to measure the actual duration of a Timeout operation (including the amount of time it took to execute the callback).","examples":[{"language":"mjs","displayName":null,"code":"import { createHook } from 'node:async_hooks';\nimport { performance, PerformanceObserver } from 'node:perf_hooks';\n\nconst set = new Set();\nconst hook = createHook({\n  init(id, type) {\n    if (type === 'Timeout') {\n      performance.mark(`Timeout-${id}-Init`);\n      set.add(id);\n    }\n  },\n  destroy(id) {\n    if (set.has(id)) {\n      set.delete(id);\n      performance.mark(`Timeout-${id}-Destroy`);\n      performance.measure(`Timeout-${id}`,\n                          `Timeout-${id}-Init`,\n                          `Timeout-${id}-Destroy`);\n    }\n  },\n});\nhook.enable();\n\nconst obs = new PerformanceObserver((list, observer) => {\n  console.log(list.getEntries()[0]);\n  performance.clearMarks();\n  performance.clearMeasures();\n  observer.disconnect();\n});\nobs.observe({ entryTypes: ['measure'], buffered: true });\n\nsetTimeout(() => {}, 1000);"},{"language":"cjs","displayName":null,"code":"const async_hooks = require('node:async_hooks');\nconst {\n  performance,\n  PerformanceObserver,\n} = require('node:perf_hooks');\n\nconst set = new Set();\nconst hook = async_hooks.createHook({\n  init(id, type) {\n    if (type === 'Timeout') {\n      performance.mark(`Timeout-${id}-Init`);\n      set.add(id);\n    }\n  },\n  destroy(id) {\n    if (set.has(id)) {\n      set.delete(id);\n      performance.mark(`Timeout-${id}-Destroy`);\n      performance.measure(`Timeout-${id}`,\n                          `Timeout-${id}-Init`,\n                          `Timeout-${id}-Destroy`);\n    }\n  },\n});\nhook.enable();\n\nconst obs = new PerformanceObserver((list, observer) => {\n  console.log(list.getEntries()[0]);\n  performance.clearMarks();\n  performance.clearMeasures();\n  observer.disconnect();\n});\nobs.observe({ entryTypes: ['measure'] });\n\nsetTimeout(() => {}, 1000);"}],"children":[]},{"kind":"section","id":"measuring-how-long-it-takes-to-load-dependencies","name":"Measuring how long it takes to load dependencies","title":"Measuring how long it takes to load dependencies","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"The following example measures the duration of `require()` operations to load\ndependencies:\n\n```mjs\nimport { performance, PerformanceObserver } from 'node:perf_hooks';\n\n// Activate the observer\nconst obs = new PerformanceObserver((list) => {\n  const entries = list.getEntries();\n  entries.forEach((entry) => {\n    console.log(`import('${entry[0]}')`, entry.duration);\n  });\n  performance.clearMarks();\n  performance.clearMeasures();\n  obs.disconnect();\n});\nobs.observe({ entryTypes: ['function'], buffered: true });\n\nconst timedImport = performance.timerify(async (module) => {\n  return await import(module);\n});\n\nawait timedImport('some-module');\n```\n\n```cjs\nconst {\n  performance,\n  PerformanceObserver,\n} = require('node:perf_hooks');\nconst mod = require('node:module');\n\n// Monkey patch the require function\nmod.Module.prototype.require =\n  performance.timerify(mod.Module.prototype.require);\nrequire = performance.timerify(require);\n\n// Activate the observer\nconst obs = new PerformanceObserver((list) => {\n  const entries = list.getEntries();\n  entries.forEach((entry) => {\n    console.log(`require('${entry[0]}')`, entry.duration);\n  });\n  performance.clearMarks();\n  performance.clearMeasures();\n  obs.disconnect();\n});\nobs.observe({ entryTypes: ['function'] });\n\nrequire('some-module');\n```","summary":"The following example measures the duration of `require()` operations to load dependencies:","examples":[{"language":"mjs","displayName":null,"code":"import { performance, PerformanceObserver } from 'node:perf_hooks';\n\n// Activate the observer\nconst obs = new PerformanceObserver((list) => {\n  const entries = list.getEntries();\n  entries.forEach((entry) => {\n    console.log(`import('${entry[0]}')`, entry.duration);\n  });\n  performance.clearMarks();\n  performance.clearMeasures();\n  obs.disconnect();\n});\nobs.observe({ entryTypes: ['function'], buffered: true });\n\nconst timedImport = performance.timerify(async (module) => {\n  return await import(module);\n});\n\nawait timedImport('some-module');"},{"language":"cjs","displayName":null,"code":"const {\n  performance,\n  PerformanceObserver,\n} = require('node:perf_hooks');\nconst mod = require('node:module');\n\n// Monkey patch the require function\nmod.Module.prototype.require =\n  performance.timerify(mod.Module.prototype.require);\nrequire = performance.timerify(require);\n\n// Activate the observer\nconst obs = new PerformanceObserver((list) => {\n  const entries = list.getEntries();\n  entries.forEach((entry) => {\n    console.log(`require('${entry[0]}')`, entry.duration);\n  });\n  performance.clearMarks();\n  performance.clearMeasures();\n  obs.disconnect();\n});\nobs.observe({ entryTypes: ['function'] });\n\nrequire('some-module');"}],"children":[]},{"kind":"section","id":"measuring-how-long-one-http-round-trip-takes","name":"Measuring how long one HTTP round-trip takes","title":"Measuring how long one HTTP round-trip takes","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"The following example is used to trace the time spent by HTTP client\n(`OutgoingMessage`) and HTTP request (`IncomingMessage`). For HTTP client,\nit means the time interval between starting the request and receiving the\nresponse, and for HTTP request, it means the time interval between receiving\nthe request and sending the response:\n\n```mjs\nimport { PerformanceObserver } from 'node:perf_hooks';\nimport { createServer, get } from 'node:http';\n\nconst obs = new PerformanceObserver((items) => {\n  items.getEntries().forEach((item) => {\n    console.log(item);\n  });\n});\n\nobs.observe({ entryTypes: ['http'] });\n\nconst PORT = 8080;\n\ncreateServer((req, res) => {\n  res.end('ok');\n}).listen(PORT, () => {\n  get(`http://127.0.0.1:${PORT}`);\n});\n```\n\n```cjs\nconst { PerformanceObserver } = require('node:perf_hooks');\nconst http = require('node:http');\n\nconst obs = new PerformanceObserver((items) => {\n  items.getEntries().forEach((item) => {\n    console.log(item);\n  });\n});\n\nobs.observe({ entryTypes: ['http'] });\n\nconst PORT = 8080;\n\nhttp.createServer((req, res) => {\n  res.end('ok');\n}).listen(PORT, () => {\n  http.get(`http://127.0.0.1:${PORT}`);\n});\n```","summary":"The following example is used to trace the time spent by HTTP client (`OutgoingMessage`) and HTTP request (`IncomingMessage`). For HTTP client, it means the time interval between starting the request and receiving the response, and for HTTP request, it means the time interval between receiving the request and sending the response:","examples":[{"language":"mjs","displayName":null,"code":"import { PerformanceObserver } from 'node:perf_hooks';\nimport { createServer, get } from 'node:http';\n\nconst obs = new PerformanceObserver((items) => {\n  items.getEntries().forEach((item) => {\n    console.log(item);\n  });\n});\n\nobs.observe({ entryTypes: ['http'] });\n\nconst PORT = 8080;\n\ncreateServer((req, res) => {\n  res.end('ok');\n}).listen(PORT, () => {\n  get(`http://127.0.0.1:${PORT}`);\n});"},{"language":"cjs","displayName":null,"code":"const { PerformanceObserver } = require('node:perf_hooks');\nconst http = require('node:http');\n\nconst obs = new PerformanceObserver((items) => {\n  items.getEntries().forEach((item) => {\n    console.log(item);\n  });\n});\n\nobs.observe({ entryTypes: ['http'] });\n\nconst PORT = 8080;\n\nhttp.createServer((req, res) => {\n  res.end('ok');\n}).listen(PORT, () => {\n  http.get(`http://127.0.0.1:${PORT}`);\n});"}],"children":[]},{"kind":"section","id":"measuring-how-long-the-netconnect-only-for-tcp-takes-when-the-connection-is-successful","name":"Measuring how long the net.connect (only for TCP) takes when the connection is successful","title":"Measuring how long the `net.connect` (only for TCP) takes when the connection is successful","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"```mjs\nimport { PerformanceObserver } from 'node:perf_hooks';\nimport { connect, createServer } from 'node:net';\n\nconst obs = new PerformanceObserver((items) => {\n  items.getEntries().forEach((item) => {\n    console.log(item);\n  });\n});\nobs.observe({ entryTypes: ['net'] });\nconst PORT = 8080;\ncreateServer((socket) => {\n  socket.destroy();\n}).listen(PORT, () => {\n  connect(PORT);\n});\n```\n\n```cjs\nconst { PerformanceObserver } = require('node:perf_hooks');\nconst net = require('node:net');\nconst obs = new PerformanceObserver((items) => {\n  items.getEntries().forEach((item) => {\n    console.log(item);\n  });\n});\nobs.observe({ entryTypes: ['net'] });\nconst PORT = 8080;\nnet.createServer((socket) => {\n  socket.destroy();\n}).listen(PORT, () => {\n  net.connect(PORT);\n});\n```","summary":"","examples":[{"language":"mjs","displayName":null,"code":"import { PerformanceObserver } from 'node:perf_hooks';\nimport { connect, createServer } from 'node:net';\n\nconst obs = new PerformanceObserver((items) => {\n  items.getEntries().forEach((item) => {\n    console.log(item);\n  });\n});\nobs.observe({ entryTypes: ['net'] });\nconst PORT = 8080;\ncreateServer((socket) => {\n  socket.destroy();\n}).listen(PORT, () => {\n  connect(PORT);\n});"},{"language":"cjs","displayName":null,"code":"const { PerformanceObserver } = require('node:perf_hooks');\nconst net = require('node:net');\nconst obs = new PerformanceObserver((items) => {\n  items.getEntries().forEach((item) => {\n    console.log(item);\n  });\n});\nobs.observe({ entryTypes: ['net'] });\nconst PORT = 8080;\nnet.createServer((socket) => {\n  socket.destroy();\n}).listen(PORT, () => {\n  net.connect(PORT);\n});"}],"children":[]},{"kind":"section","id":"measuring-how-long-the-dns-takes-when-the-request-is-successful","name":"Measuring how long the DNS takes when the request is successful","title":"Measuring how long the DNS takes when the request is successful","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"```mjs\nimport { PerformanceObserver } from 'node:perf_hooks';\nimport { lookup, promises } from 'node:dns';\n\nconst obs = new PerformanceObserver((items) => {\n  items.getEntries().forEach((item) => {\n    console.log(item);\n  });\n});\nobs.observe({ entryTypes: ['dns'] });\nlookup('localhost', () => {});\npromises.resolve('localhost');\n```\n\n```cjs\nconst { PerformanceObserver } = require('node:perf_hooks');\nconst dns = require('node:dns');\nconst obs = new PerformanceObserver((items) => {\n  items.getEntries().forEach((item) => {\n    console.log(item);\n  });\n});\nobs.observe({ entryTypes: ['dns'] });\ndns.lookup('localhost', () => {});\ndns.promises.resolve('localhost');\n```","summary":"","examples":[{"language":"mjs","displayName":null,"code":"import { PerformanceObserver } from 'node:perf_hooks';\nimport { lookup, promises } from 'node:dns';\n\nconst obs = new PerformanceObserver((items) => {\n  items.getEntries().forEach((item) => {\n    console.log(item);\n  });\n});\nobs.observe({ entryTypes: ['dns'] });\nlookup('localhost', () => {});\npromises.resolve('localhost');"},{"language":"cjs","displayName":null,"code":"const { PerformanceObserver } = require('node:perf_hooks');\nconst dns = require('node:dns');\nconst obs = new PerformanceObserver((items) => {\n  items.getEntries().forEach((item) => {\n    console.log(item);\n  });\n});\nobs.observe({ entryTypes: ['dns'] });\ndns.lookup('localhost', () => {});\ndns.promises.resolve('localhost');"}],"children":[]}]}]}