@rio-cloud/cdk-v2-constructs 8.2.0 → 8.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +2 -2
- package/node_modules/@types/node/README.md +3 -3
- package/node_modules/@types/node/assert/strict.d.ts +105 -2
- package/node_modules/@types/node/assert.d.ts +211 -92
- package/node_modules/@types/node/async_hooks.d.ts +103 -19
- package/node_modules/@types/node/buffer.buffer.d.ts +472 -0
- package/node_modules/@types/node/buffer.d.ts +88 -516
- package/node_modules/@types/node/child_process.d.ts +167 -231
- package/node_modules/@types/node/cluster.d.ts +172 -26
- package/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
- package/node_modules/@types/node/console.d.ts +66 -28
- package/node_modules/@types/node/constants.d.ts +14 -12
- package/node_modules/@types/node/crypto.d.ts +1458 -497
- package/node_modules/@types/node/dgram.d.ts +44 -30
- package/node_modules/@types/node/diagnostics_channel.d.ts +389 -4
- package/node_modules/@types/node/dns/promises.d.ts +120 -42
- package/node_modules/@types/node/dns.d.ts +209 -95
- package/node_modules/@types/node/domain.d.ts +14 -18
- package/node_modules/@types/node/events.d.ts +245 -113
- package/node_modules/@types/node/fs/promises.d.ts +194 -96
- package/node_modules/@types/node/fs.d.ts +695 -270
- package/node_modules/@types/node/globals.d.ts +97 -308
- package/node_modules/@types/node/globals.typedarray.d.ts +41 -0
- package/node_modules/@types/node/http.d.ts +363 -97
- package/node_modules/@types/node/http2.d.ts +684 -231
- package/node_modules/@types/node/https.d.ts +122 -87
- package/node_modules/@types/node/index.d.ts +24 -11
- package/node_modules/@types/node/inspector.d.ts +220 -2690
- package/node_modules/@types/node/inspector.generated.d.ts +4239 -0
- package/node_modules/@types/node/module.d.ts +705 -149
- package/node_modules/@types/node/net.d.ts +178 -54
- package/node_modules/@types/node/os.d.ts +47 -17
- package/node_modules/@types/node/package.json +22 -97
- package/node_modules/@types/node/path.d.ts +12 -3
- package/node_modules/@types/node/perf_hooks.d.ts +500 -97
- package/node_modules/@types/node/process.d.ts +657 -87
- package/node_modules/@types/node/punycode.d.ts +5 -5
- package/node_modules/@types/node/querystring.d.ts +24 -13
- package/node_modules/@types/node/readline/promises.d.ts +25 -14
- package/node_modules/@types/node/readline.d.ts +102 -41
- package/node_modules/@types/node/repl.d.ts +38 -30
- package/node_modules/@types/node/sea.d.ts +162 -0
- package/node_modules/@types/node/sqlite.d.ts +1040 -0
- package/node_modules/@types/node/stream/consumers.d.ts +33 -7
- package/node_modules/@types/node/stream/promises.d.ts +8 -1
- package/node_modules/@types/node/stream/web.d.ts +251 -28
- package/node_modules/@types/node/stream.d.ts +1060 -1055
- package/node_modules/@types/node/string_decoder.d.ts +8 -8
- package/node_modules/@types/node/test.d.ts +2133 -1166
- package/node_modules/@types/node/timers/promises.d.ts +31 -16
- package/node_modules/@types/node/timers.d.ts +159 -114
- package/node_modules/@types/node/tls.d.ts +232 -163
- package/node_modules/@types/node/trace_events.d.ts +43 -28
- package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +468 -0
- package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
- package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +36 -0
- package/node_modules/@types/node/ts5.6/index.d.ts +103 -0
- package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
- package/node_modules/@types/node/ts5.7/index.d.ts +103 -0
- package/node_modules/@types/node/tty.d.ts +9 -9
- package/node_modules/@types/node/url.d.ts +236 -84
- package/node_modules/@types/node/util.d.ts +562 -412
- package/node_modules/@types/node/v8.d.ts +368 -21
- package/node_modules/@types/node/vm.d.ts +443 -149
- package/node_modules/@types/node/wasi.d.ts +62 -18
- package/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
- package/node_modules/@types/node/web-globals/crypto.d.ts +32 -0
- package/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
- package/node_modules/@types/node/web-globals/events.d.ts +97 -0
- package/node_modules/@types/node/web-globals/fetch.d.ts +62 -0
- package/node_modules/@types/node/web-globals/navigator.d.ts +25 -0
- package/node_modules/@types/node/web-globals/storage.d.ts +24 -0
- package/node_modules/@types/node/web-globals/streams.d.ts +22 -0
- package/node_modules/@types/node/worker_threads.d.ts +310 -107
- package/node_modules/@types/node/zlib.d.ts +301 -73
- package/node_modules/undici-types/LICENSE +21 -0
- package/node_modules/undici-types/agent.d.ts +13 -12
- package/node_modules/undici-types/api.d.ts +26 -26
- package/node_modules/undici-types/balanced-pool.d.ts +19 -7
- package/node_modules/undici-types/cache-interceptor.d.ts +173 -0
- package/node_modules/undici-types/client-stats.d.ts +15 -0
- package/node_modules/undici-types/client.d.ts +26 -15
- package/node_modules/undici-types/connector.d.ts +2 -2
- package/node_modules/undici-types/cookies.d.ts +2 -0
- package/node_modules/undici-types/diagnostics-channel.d.ts +19 -12
- package/node_modules/undici-types/dispatcher.d.ts +148 -113
- package/node_modules/undici-types/env-http-proxy-agent.d.ts +22 -0
- package/node_modules/undici-types/errors.d.ts +79 -46
- package/node_modules/undici-types/eventsource.d.ts +66 -0
- package/node_modules/undici-types/fetch.d.ts +41 -39
- package/node_modules/undici-types/formdata.d.ts +8 -8
- package/node_modules/undici-types/global-dispatcher.d.ts +4 -4
- package/node_modules/undici-types/global-origin.d.ts +5 -5
- package/node_modules/undici-types/h2c-client.d.ts +73 -0
- package/node_modules/undici-types/handlers.d.ts +11 -5
- package/node_modules/undici-types/header.d.ts +157 -1
- package/node_modules/undici-types/index.d.ts +68 -43
- package/node_modules/undici-types/interceptors.d.ts +71 -3
- package/node_modules/undici-types/mock-agent.d.ts +36 -18
- package/node_modules/undici-types/mock-call-history.d.ts +111 -0
- package/node_modules/undici-types/mock-client.d.ts +6 -4
- package/node_modules/undici-types/mock-errors.d.ts +3 -3
- package/node_modules/undici-types/mock-interceptor.d.ts +24 -23
- package/node_modules/undici-types/mock-pool.d.ts +6 -4
- package/node_modules/undici-types/package.json +1 -1
- package/node_modules/undici-types/patch.d.ts +0 -42
- package/node_modules/undici-types/pool-stats.d.ts +8 -8
- package/node_modules/undici-types/pool.d.ts +21 -8
- package/node_modules/undici-types/proxy-agent.d.ts +5 -6
- package/node_modules/undici-types/readable.d.ts +24 -17
- package/node_modules/undici-types/retry-agent.d.ts +8 -0
- package/node_modules/undici-types/retry-handler.d.ts +125 -0
- package/node_modules/undici-types/round-robin-pool.d.ts +41 -0
- package/node_modules/undici-types/snapshot-agent.d.ts +109 -0
- package/node_modules/undici-types/util.d.ts +18 -0
- package/node_modules/undici-types/utility.d.ts +7 -0
- package/node_modules/undici-types/webidl.d.ts +157 -36
- package/node_modules/undici-types/websocket.d.ts +67 -12
- package/package.json +9 -60
- package/version.json +1 -1
- package/node_modules/@types/node/dom-events.d.ts +0 -122
- package/node_modules/@types/node/globals.global.d.ts +0 -1
- package/node_modules/@types/node/ts4.8/assert/strict.d.ts +0 -8
- package/node_modules/@types/node/ts4.8/assert.d.ts +0 -996
- package/node_modules/@types/node/ts4.8/async_hooks.d.ts +0 -539
- package/node_modules/@types/node/ts4.8/buffer.d.ts +0 -2362
- package/node_modules/@types/node/ts4.8/child_process.d.ts +0 -1540
- package/node_modules/@types/node/ts4.8/cluster.d.ts +0 -432
- package/node_modules/@types/node/ts4.8/console.d.ts +0 -415
- package/node_modules/@types/node/ts4.8/constants.d.ts +0 -19
- package/node_modules/@types/node/ts4.8/crypto.d.ts +0 -4455
- package/node_modules/@types/node/ts4.8/dgram.d.ts +0 -586
- package/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +0 -191
- package/node_modules/@types/node/ts4.8/dns/promises.d.ts +0 -425
- package/node_modules/@types/node/ts4.8/dns.d.ts +0 -809
- package/node_modules/@types/node/ts4.8/dom-events.d.ts +0 -122
- package/node_modules/@types/node/ts4.8/domain.d.ts +0 -170
- package/node_modules/@types/node/ts4.8/events.d.ts +0 -796
- package/node_modules/@types/node/ts4.8/fs/promises.d.ts +0 -1232
- package/node_modules/@types/node/ts4.8/fs.d.ts +0 -4289
- package/node_modules/@types/node/ts4.8/globals.d.ts +0 -381
- package/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -1
- package/node_modules/@types/node/ts4.8/http.d.ts +0 -1888
- package/node_modules/@types/node/ts4.8/http2.d.ts +0 -2382
- package/node_modules/@types/node/ts4.8/https.d.ts +0 -550
- package/node_modules/@types/node/ts4.8/index.d.ts +0 -88
- package/node_modules/@types/node/ts4.8/inspector.d.ts +0 -2747
- package/node_modules/@types/node/ts4.8/module.d.ts +0 -287
- package/node_modules/@types/node/ts4.8/net.d.ts +0 -949
- package/node_modules/@types/node/ts4.8/os.d.ts +0 -477
- package/node_modules/@types/node/ts4.8/path.d.ts +0 -191
- package/node_modules/@types/node/ts4.8/perf_hooks.d.ts +0 -639
- package/node_modules/@types/node/ts4.8/process.d.ts +0 -1532
- package/node_modules/@types/node/ts4.8/punycode.d.ts +0 -117
- package/node_modules/@types/node/ts4.8/querystring.d.ts +0 -141
- package/node_modules/@types/node/ts4.8/readline/promises.d.ts +0 -150
- package/node_modules/@types/node/ts4.8/readline.d.ts +0 -539
- package/node_modules/@types/node/ts4.8/repl.d.ts +0 -430
- package/node_modules/@types/node/ts4.8/stream/consumers.d.ts +0 -12
- package/node_modules/@types/node/ts4.8/stream/promises.d.ts +0 -83
- package/node_modules/@types/node/ts4.8/stream/web.d.ts +0 -350
- package/node_modules/@types/node/ts4.8/stream.d.ts +0 -1701
- package/node_modules/@types/node/ts4.8/string_decoder.d.ts +0 -67
- package/node_modules/@types/node/ts4.8/test.d.ts +0 -1382
- package/node_modules/@types/node/ts4.8/timers/promises.d.ts +0 -93
- package/node_modules/@types/node/ts4.8/timers.d.ts +0 -240
- package/node_modules/@types/node/ts4.8/tls.d.ts +0 -1210
- package/node_modules/@types/node/ts4.8/trace_events.d.ts +0 -182
- package/node_modules/@types/node/ts4.8/tty.d.ts +0 -208
- package/node_modules/@types/node/ts4.8/url.d.ts +0 -927
- package/node_modules/@types/node/ts4.8/util.d.ts +0 -2186
- package/node_modules/@types/node/ts4.8/v8.d.ts +0 -635
- package/node_modules/@types/node/ts4.8/vm.d.ts +0 -901
- package/node_modules/@types/node/ts4.8/wasi.d.ts +0 -158
- package/node_modules/@types/node/ts4.8/worker_threads.d.ts +0 -691
- package/node_modules/@types/node/ts4.8/zlib.d.ts +0 -517
- package/node_modules/argparse/CHANGELOG.md +0 -216
- package/node_modules/undici-types/file.d.ts +0 -39
- package/node_modules/undici-types/filereader.d.ts +0 -54
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* * [Resource Timing](https://www.w3.org/TR/resource-timing-2/)
|
|
11
11
|
*
|
|
12
12
|
* ```js
|
|
13
|
-
*
|
|
13
|
+
* import { PerformanceObserver, performance } from 'node:perf_hooks';
|
|
14
14
|
*
|
|
15
15
|
* const obs = new PerformanceObserver((items) => {
|
|
16
16
|
* console.log(items.getEntries()[0].duration);
|
|
@@ -27,24 +27,34 @@
|
|
|
27
27
|
* performance.measure('A to B', 'A', 'B');
|
|
28
28
|
* });
|
|
29
29
|
* ```
|
|
30
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
30
|
+
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/perf_hooks.js)
|
|
31
31
|
*/
|
|
32
32
|
declare module "perf_hooks" {
|
|
33
33
|
import { AsyncResource } from "node:async_hooks";
|
|
34
|
-
type EntryType =
|
|
34
|
+
type EntryType =
|
|
35
|
+
| "dns" // Node.js only
|
|
36
|
+
| "function" // Node.js only
|
|
37
|
+
| "gc" // Node.js only
|
|
38
|
+
| "http2" // Node.js only
|
|
39
|
+
| "http" // Node.js only
|
|
40
|
+
| "mark" // available on the Web
|
|
41
|
+
| "measure" // available on the Web
|
|
42
|
+
| "net" // Node.js only
|
|
43
|
+
| "node" // Node.js only
|
|
44
|
+
| "resource"; // available on the Web
|
|
35
45
|
interface NodeGCPerformanceDetail {
|
|
36
46
|
/**
|
|
37
|
-
* When `performanceEntry.entryType` is equal to 'gc',
|
|
47
|
+
* When `performanceEntry.entryType` is equal to 'gc', the `performance.kind` property identifies
|
|
38
48
|
* the type of garbage collection operation that occurred.
|
|
39
49
|
* See perf_hooks.constants for valid values.
|
|
40
50
|
*/
|
|
41
|
-
readonly kind
|
|
51
|
+
readonly kind: number;
|
|
42
52
|
/**
|
|
43
53
|
* When `performanceEntry.entryType` is equal to 'gc', the `performance.flags`
|
|
44
54
|
* property contains additional information about garbage collection operation.
|
|
45
55
|
* See perf_hooks.constants for valid values.
|
|
46
56
|
*/
|
|
47
|
-
readonly flags
|
|
57
|
+
readonly flags: number;
|
|
48
58
|
}
|
|
49
59
|
/**
|
|
50
60
|
* The constructor of this class is not exposed to users directly.
|
|
@@ -82,11 +92,6 @@ declare module "perf_hooks" {
|
|
|
82
92
|
* @since v8.5.0
|
|
83
93
|
*/
|
|
84
94
|
readonly entryType: EntryType;
|
|
85
|
-
/**
|
|
86
|
-
* Additional detail specific to the `entryType`.
|
|
87
|
-
* @since v16.0.0
|
|
88
|
-
*/
|
|
89
|
-
readonly detail?: NodeGCPerformanceDetail | unknown | undefined; // TODO: Narrow this based on entry type.
|
|
90
95
|
toJSON(): any;
|
|
91
96
|
}
|
|
92
97
|
/**
|
|
@@ -94,6 +99,7 @@ declare module "perf_hooks" {
|
|
|
94
99
|
* @since v18.2.0, v16.17.0
|
|
95
100
|
*/
|
|
96
101
|
class PerformanceMark extends PerformanceEntry {
|
|
102
|
+
readonly detail: any;
|
|
97
103
|
readonly duration: 0;
|
|
98
104
|
readonly entryType: "mark";
|
|
99
105
|
}
|
|
@@ -104,8 +110,24 @@ declare module "perf_hooks" {
|
|
|
104
110
|
* @since v18.2.0, v16.17.0
|
|
105
111
|
*/
|
|
106
112
|
class PerformanceMeasure extends PerformanceEntry {
|
|
113
|
+
readonly detail: any;
|
|
107
114
|
readonly entryType: "measure";
|
|
108
115
|
}
|
|
116
|
+
interface UVMetrics {
|
|
117
|
+
/**
|
|
118
|
+
* Number of event loop iterations.
|
|
119
|
+
*/
|
|
120
|
+
readonly loopCount: number;
|
|
121
|
+
/**
|
|
122
|
+
* Number of events that have been processed by the event handler.
|
|
123
|
+
*/
|
|
124
|
+
readonly events: number;
|
|
125
|
+
/**
|
|
126
|
+
* Number of events that were waiting to be processed when the event provider was called.
|
|
127
|
+
*/
|
|
128
|
+
readonly eventsWaiting: number;
|
|
129
|
+
}
|
|
130
|
+
// TODO: PerformanceNodeEntry is missing
|
|
109
131
|
/**
|
|
110
132
|
* _This property is an extension by Node.js. It is not available in Web browsers._
|
|
111
133
|
*
|
|
@@ -114,6 +136,7 @@ declare module "perf_hooks" {
|
|
|
114
136
|
* @since v8.5.0
|
|
115
137
|
*/
|
|
116
138
|
class PerformanceNodeTiming extends PerformanceEntry {
|
|
139
|
+
readonly entryType: "node";
|
|
117
140
|
/**
|
|
118
141
|
* The high resolution millisecond timestamp at which the Node.js process
|
|
119
142
|
* completed bootstrapping. If bootstrapping has not yet finished, the property
|
|
@@ -150,6 +173,21 @@ declare module "perf_hooks" {
|
|
|
150
173
|
* @since v8.5.0
|
|
151
174
|
*/
|
|
152
175
|
readonly loopStart: number;
|
|
176
|
+
/**
|
|
177
|
+
* The high resolution millisecond timestamp at which the Node.js process was initialized.
|
|
178
|
+
* @since v8.5.0
|
|
179
|
+
*/
|
|
180
|
+
readonly nodeStart: number;
|
|
181
|
+
/**
|
|
182
|
+
* This is a wrapper to the `uv_metrics_info` function.
|
|
183
|
+
* It returns the current set of event loop metrics.
|
|
184
|
+
*
|
|
185
|
+
* It is recommended to use this property inside a function whose execution was
|
|
186
|
+
* scheduled using `setImmediate` to avoid collecting metrics before finishing all
|
|
187
|
+
* operations scheduled during the current loop iteration.
|
|
188
|
+
* @since v22.8.0, v20.18.0
|
|
189
|
+
*/
|
|
190
|
+
readonly uvMetricsInfo: UVMetrics;
|
|
153
191
|
/**
|
|
154
192
|
* The high resolution millisecond timestamp at which the V8 platform was
|
|
155
193
|
* initialized.
|
|
@@ -162,14 +200,6 @@ declare module "perf_hooks" {
|
|
|
162
200
|
active: number;
|
|
163
201
|
utilization: number;
|
|
164
202
|
}
|
|
165
|
-
/**
|
|
166
|
-
* @param util1 The result of a previous call to eventLoopUtilization()
|
|
167
|
-
* @param util2 The result of a previous call to eventLoopUtilization() prior to util1
|
|
168
|
-
*/
|
|
169
|
-
type EventLoopUtilityFunction = (
|
|
170
|
-
util1?: EventLoopUtilization,
|
|
171
|
-
util2?: EventLoopUtilization,
|
|
172
|
-
) => EventLoopUtilization;
|
|
173
203
|
interface MarkOptions {
|
|
174
204
|
/**
|
|
175
205
|
* Additional optional detail to include with the mark.
|
|
@@ -177,7 +207,7 @@ declare module "perf_hooks" {
|
|
|
177
207
|
detail?: unknown | undefined;
|
|
178
208
|
/**
|
|
179
209
|
* An optional timestamp to be used as the mark time.
|
|
180
|
-
* @default `performance.now()
|
|
210
|
+
* @default `performance.now()`
|
|
181
211
|
*/
|
|
182
212
|
startTime?: number | undefined;
|
|
183
213
|
}
|
|
@@ -185,7 +215,7 @@ declare module "perf_hooks" {
|
|
|
185
215
|
/**
|
|
186
216
|
* Additional optional detail to include with the mark.
|
|
187
217
|
*/
|
|
188
|
-
detail?: unknown
|
|
218
|
+
detail?: unknown;
|
|
189
219
|
/**
|
|
190
220
|
* Duration between start and end times.
|
|
191
221
|
*/
|
|
@@ -201,26 +231,44 @@ declare module "perf_hooks" {
|
|
|
201
231
|
}
|
|
202
232
|
interface TimerifyOptions {
|
|
203
233
|
/**
|
|
204
|
-
* A histogram object created using
|
|
205
|
-
*
|
|
206
|
-
* nanoseconds.
|
|
234
|
+
* A histogram object created using `perf_hooks.createHistogram()` that will record runtime
|
|
235
|
+
* durations in nanoseconds.
|
|
207
236
|
*/
|
|
208
237
|
histogram?: RecordableHistogram | undefined;
|
|
209
238
|
}
|
|
210
239
|
interface Performance {
|
|
211
240
|
/**
|
|
212
|
-
* If name is not provided, removes all PerformanceMark objects from the Performance Timeline.
|
|
213
|
-
* If name is provided, removes only the named mark.
|
|
214
|
-
* @
|
|
241
|
+
* If `name` is not provided, removes all `PerformanceMark` objects from the Performance Timeline.
|
|
242
|
+
* If `name` is provided, removes only the named mark.
|
|
243
|
+
* @since v8.5.0
|
|
215
244
|
*/
|
|
216
245
|
clearMarks(name?: string): void;
|
|
217
246
|
/**
|
|
218
|
-
* If name is not provided, removes all PerformanceMeasure objects from the Performance Timeline.
|
|
219
|
-
* If name is provided, removes only the named measure.
|
|
220
|
-
* @param name
|
|
247
|
+
* If `name` is not provided, removes all `PerformanceMeasure` objects from the Performance Timeline.
|
|
248
|
+
* If `name` is provided, removes only the named measure.
|
|
221
249
|
* @since v16.7.0
|
|
222
250
|
*/
|
|
223
251
|
clearMeasures(name?: string): void;
|
|
252
|
+
/**
|
|
253
|
+
* If `name` is not provided, removes all `PerformanceResourceTiming` objects from the Resource Timeline.
|
|
254
|
+
* If `name` is provided, removes only the named resource.
|
|
255
|
+
* @since v18.2.0, v16.17.0
|
|
256
|
+
*/
|
|
257
|
+
clearResourceTimings(name?: string): void;
|
|
258
|
+
/**
|
|
259
|
+
* This is an alias of `perf_hooks.eventLoopUtilization()`.
|
|
260
|
+
*
|
|
261
|
+
* _This property is an extension by Node.js. It is not available in Web browsers._
|
|
262
|
+
* @since v14.10.0, v12.19.0
|
|
263
|
+
* @param utilization1 The result of a previous call to
|
|
264
|
+
* `eventLoopUtilization()`.
|
|
265
|
+
* @param utilization2 The result of a previous call to
|
|
266
|
+
* `eventLoopUtilization()` prior to `utilization1`.
|
|
267
|
+
*/
|
|
268
|
+
eventLoopUtilization(
|
|
269
|
+
utilization1?: EventLoopUtilization,
|
|
270
|
+
utilization2?: EventLoopUtilization,
|
|
271
|
+
): EventLoopUtilization;
|
|
224
272
|
/**
|
|
225
273
|
* Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`.
|
|
226
274
|
* If you are only interested in performance entries of certain types or that have certain names, see
|
|
@@ -244,14 +292,41 @@ declare module "perf_hooks" {
|
|
|
244
292
|
*/
|
|
245
293
|
getEntriesByType(type: EntryType): PerformanceEntry[];
|
|
246
294
|
/**
|
|
247
|
-
* Creates a new PerformanceMark entry in the Performance Timeline.
|
|
248
|
-
* A PerformanceMark is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'mark'
|
|
249
|
-
* and whose performanceEntry.duration is always 0
|
|
295
|
+
* Creates a new `PerformanceMark` entry in the Performance Timeline.
|
|
296
|
+
* A `PerformanceMark` is a subclass of `PerformanceEntry` whose `performanceEntry.entryType` is always `'mark'`,
|
|
297
|
+
* and whose `performanceEntry.duration` is always `0`.
|
|
250
298
|
* Performance marks are used to mark specific significant moments in the Performance Timeline.
|
|
299
|
+
*
|
|
300
|
+
* The created `PerformanceMark` entry is put in the global Performance Timeline and can be queried with
|
|
301
|
+
* `performance.getEntries`, `performance.getEntriesByName`, and `performance.getEntriesByType`. When the observation is
|
|
302
|
+
* performed, the entries should be cleared from the global Performance Timeline manually with `performance.clearMarks`.
|
|
251
303
|
* @param name
|
|
252
|
-
* @return The PerformanceMark entry that was created
|
|
253
304
|
*/
|
|
254
|
-
mark(name
|
|
305
|
+
mark(name: string, options?: MarkOptions): PerformanceMark;
|
|
306
|
+
/**
|
|
307
|
+
* Creates a new `PerformanceResourceTiming` entry in the Resource Timeline.
|
|
308
|
+
* A `PerformanceResourceTiming` is a subclass of `PerformanceEntry` whose `performanceEntry.entryType` is always `'resource'`.
|
|
309
|
+
* Performance resources are used to mark moments in the Resource Timeline.
|
|
310
|
+
* @param timingInfo [Fetch Timing Info](https://fetch.spec.whatwg.org/#fetch-timing-info)
|
|
311
|
+
* @param requestedUrl The resource url
|
|
312
|
+
* @param initiatorType The initiator name, e.g: 'fetch'
|
|
313
|
+
* @param global
|
|
314
|
+
* @param cacheMode The cache mode must be an empty string ('') or 'local'
|
|
315
|
+
* @param bodyInfo [Fetch Response Body Info](https://fetch.spec.whatwg.org/#response-body-info)
|
|
316
|
+
* @param responseStatus The response's status code
|
|
317
|
+
* @param deliveryType The delivery type. Default: ''.
|
|
318
|
+
* @since v18.2.0, v16.17.0
|
|
319
|
+
*/
|
|
320
|
+
markResourceTiming(
|
|
321
|
+
timingInfo: object,
|
|
322
|
+
requestedUrl: string,
|
|
323
|
+
initiatorType: string,
|
|
324
|
+
global: object,
|
|
325
|
+
cacheMode: "" | "local",
|
|
326
|
+
bodyInfo: object,
|
|
327
|
+
responseStatus: number,
|
|
328
|
+
deliveryType?: string,
|
|
329
|
+
): PerformanceResourceTiming;
|
|
255
330
|
/**
|
|
256
331
|
* Creates a new PerformanceMeasure entry in the Performance Timeline.
|
|
257
332
|
* A PerformanceMeasure is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'measure',
|
|
@@ -271,40 +346,54 @@ declare module "perf_hooks" {
|
|
|
271
346
|
measure(name: string, startMark?: string, endMark?: string): PerformanceMeasure;
|
|
272
347
|
measure(name: string, options: MeasureOptions): PerformanceMeasure;
|
|
273
348
|
/**
|
|
274
|
-
*
|
|
349
|
+
* _This property is an extension by Node.js. It is not available in Web browsers._
|
|
350
|
+
*
|
|
351
|
+
* An instance of the `PerformanceNodeTiming` class that provides performance metrics for specific Node.js operational milestones.
|
|
352
|
+
* @since v8.5.0
|
|
275
353
|
*/
|
|
276
354
|
readonly nodeTiming: PerformanceNodeTiming;
|
|
277
355
|
/**
|
|
278
|
-
*
|
|
356
|
+
* Returns the current high resolution millisecond timestamp, where 0 represents the start of the current `node` process.
|
|
357
|
+
* @since v8.5.0
|
|
279
358
|
*/
|
|
280
359
|
now(): number;
|
|
281
360
|
/**
|
|
282
|
-
*
|
|
361
|
+
* Sets the global performance resource timing buffer size to the specified number of "resource" type performance entry objects.
|
|
362
|
+
*
|
|
363
|
+
* By default the max buffer size is set to 250.
|
|
364
|
+
* @since v18.8.0
|
|
365
|
+
*/
|
|
366
|
+
setResourceTimingBufferSize(maxSize: number): void;
|
|
367
|
+
/**
|
|
368
|
+
* The [`timeOrigin`](https://w3c.github.io/hr-time/#dom-performance-timeorigin) specifies the high resolution millisecond timestamp
|
|
369
|
+
* at which the current `node` process began, measured in Unix time.
|
|
370
|
+
* @since v8.5.0
|
|
283
371
|
*/
|
|
284
372
|
readonly timeOrigin: number;
|
|
285
373
|
/**
|
|
286
|
-
*
|
|
287
|
-
*
|
|
288
|
-
*
|
|
374
|
+
* This is an alias of `perf_hooks.timerify()`.
|
|
375
|
+
*
|
|
376
|
+
* _This property is an extension by Node.js. It is not available in Web browsers._
|
|
377
|
+
* @since v8.5.0
|
|
289
378
|
*/
|
|
290
|
-
timerify<T extends (...
|
|
379
|
+
timerify<T extends (...args: any[]) => any>(fn: T, options?: TimerifyOptions): T;
|
|
291
380
|
/**
|
|
292
|
-
*
|
|
293
|
-
*
|
|
294
|
-
*
|
|
381
|
+
* An object which is JSON representation of the performance object. It is similar to
|
|
382
|
+
* [`window.performance.toJSON`](https://developer.mozilla.org/en-US/docs/Web/API/Performance/toJSON) in browsers.
|
|
383
|
+
* @since v16.1.0
|
|
295
384
|
*/
|
|
296
|
-
|
|
385
|
+
toJSON(): any;
|
|
297
386
|
}
|
|
298
|
-
|
|
387
|
+
class PerformanceObserverEntryList {
|
|
299
388
|
/**
|
|
300
389
|
* Returns a list of `PerformanceEntry` objects in chronological order
|
|
301
390
|
* with respect to `performanceEntry.startTime`.
|
|
302
391
|
*
|
|
303
392
|
* ```js
|
|
304
|
-
*
|
|
393
|
+
* import {
|
|
305
394
|
* performance,
|
|
306
395
|
* PerformanceObserver,
|
|
307
|
-
* }
|
|
396
|
+
* } from 'node:perf_hooks';
|
|
308
397
|
*
|
|
309
398
|
* const obs = new PerformanceObserver((perfObserverList, observer) => {
|
|
310
399
|
* console.log(perfObserverList.getEntries());
|
|
@@ -314,13 +403,15 @@ declare module "perf_hooks" {
|
|
|
314
403
|
* * name: 'test',
|
|
315
404
|
* * entryType: 'mark',
|
|
316
405
|
* * startTime: 81.465639,
|
|
317
|
-
* * duration: 0
|
|
406
|
+
* * duration: 0,
|
|
407
|
+
* * detail: null
|
|
318
408
|
* * },
|
|
319
409
|
* * PerformanceEntry {
|
|
320
410
|
* * name: 'meow',
|
|
321
411
|
* * entryType: 'mark',
|
|
322
412
|
* * startTime: 81.860064,
|
|
323
|
-
* * duration: 0
|
|
413
|
+
* * duration: 0,
|
|
414
|
+
* * detail: null
|
|
324
415
|
* * }
|
|
325
416
|
* * ]
|
|
326
417
|
*
|
|
@@ -342,10 +433,10 @@ declare module "perf_hooks" {
|
|
|
342
433
|
* equal to `name`, and optionally, whose `performanceEntry.entryType` is equal to`type`.
|
|
343
434
|
*
|
|
344
435
|
* ```js
|
|
345
|
-
*
|
|
436
|
+
* import {
|
|
346
437
|
* performance,
|
|
347
438
|
* PerformanceObserver,
|
|
348
|
-
* }
|
|
439
|
+
* } from 'node:perf_hooks';
|
|
349
440
|
*
|
|
350
441
|
* const obs = new PerformanceObserver((perfObserverList, observer) => {
|
|
351
442
|
* console.log(perfObserverList.getEntriesByName('meow'));
|
|
@@ -355,7 +446,8 @@ declare module "perf_hooks" {
|
|
|
355
446
|
* * name: 'meow',
|
|
356
447
|
* * entryType: 'mark',
|
|
357
448
|
* * startTime: 98.545991,
|
|
358
|
-
* * duration: 0
|
|
449
|
+
* * duration: 0,
|
|
450
|
+
* * detail: null
|
|
359
451
|
* * }
|
|
360
452
|
* * ]
|
|
361
453
|
*
|
|
@@ -368,7 +460,8 @@ declare module "perf_hooks" {
|
|
|
368
460
|
* * name: 'test',
|
|
369
461
|
* * entryType: 'mark',
|
|
370
462
|
* * startTime: 63.518931,
|
|
371
|
-
* * duration: 0
|
|
463
|
+
* * duration: 0,
|
|
464
|
+
* * detail: null
|
|
372
465
|
* * }
|
|
373
466
|
* * ]
|
|
374
467
|
*
|
|
@@ -388,13 +481,13 @@ declare module "perf_hooks" {
|
|
|
388
481
|
getEntriesByName(name: string, type?: EntryType): PerformanceEntry[];
|
|
389
482
|
/**
|
|
390
483
|
* Returns a list of `PerformanceEntry` objects in chronological order
|
|
391
|
-
* with respect to `performanceEntry.startTime` whose `performanceEntry.entryType`is equal to `type`.
|
|
484
|
+
* with respect to `performanceEntry.startTime` whose `performanceEntry.entryType` is equal to `type`.
|
|
392
485
|
*
|
|
393
486
|
* ```js
|
|
394
|
-
*
|
|
487
|
+
* import {
|
|
395
488
|
* performance,
|
|
396
489
|
* PerformanceObserver,
|
|
397
|
-
* }
|
|
490
|
+
* } from 'node:perf_hooks';
|
|
398
491
|
*
|
|
399
492
|
* const obs = new PerformanceObserver((perfObserverList, observer) => {
|
|
400
493
|
* console.log(perfObserverList.getEntriesByType('mark'));
|
|
@@ -404,13 +497,15 @@ declare module "perf_hooks" {
|
|
|
404
497
|
* * name: 'test',
|
|
405
498
|
* * entryType: 'mark',
|
|
406
499
|
* * startTime: 55.897834,
|
|
407
|
-
* * duration: 0
|
|
500
|
+
* * duration: 0,
|
|
501
|
+
* * detail: null
|
|
408
502
|
* * },
|
|
409
503
|
* * PerformanceEntry {
|
|
410
504
|
* * name: 'meow',
|
|
411
505
|
* * entryType: 'mark',
|
|
412
506
|
* * startTime: 56.350146,
|
|
413
|
-
* * duration: 0
|
|
507
|
+
* * duration: 0,
|
|
508
|
+
* * detail: null
|
|
414
509
|
* * }
|
|
415
510
|
* * ]
|
|
416
511
|
*
|
|
@@ -439,13 +534,13 @@ declare module "perf_hooks" {
|
|
|
439
534
|
*/
|
|
440
535
|
disconnect(): void;
|
|
441
536
|
/**
|
|
442
|
-
* Subscribes the `PerformanceObserver` instance to notifications of new `PerformanceEntry` instances identified either by `options.entryTypes`or `options.type`:
|
|
537
|
+
* Subscribes the `PerformanceObserver` instance to notifications of new `PerformanceEntry` instances identified either by `options.entryTypes` or `options.type`:
|
|
443
538
|
*
|
|
444
539
|
* ```js
|
|
445
|
-
*
|
|
540
|
+
* import {
|
|
446
541
|
* performance,
|
|
447
542
|
* PerformanceObserver,
|
|
448
|
-
* }
|
|
543
|
+
* } from 'node:perf_hooks';
|
|
449
544
|
*
|
|
450
545
|
* const obs = new PerformanceObserver((list, observer) => {
|
|
451
546
|
* // Called once asynchronously. `list` contains three items.
|
|
@@ -468,6 +563,109 @@ declare module "perf_hooks" {
|
|
|
468
563
|
buffered?: boolean | undefined;
|
|
469
564
|
},
|
|
470
565
|
): void;
|
|
566
|
+
/**
|
|
567
|
+
* @since v16.0.0
|
|
568
|
+
* @returns Current list of entries stored in the performance observer, emptying it out.
|
|
569
|
+
*/
|
|
570
|
+
takeRecords(): PerformanceEntry[];
|
|
571
|
+
}
|
|
572
|
+
/**
|
|
573
|
+
* Provides detailed network timing data regarding the loading of an application's resources.
|
|
574
|
+
*
|
|
575
|
+
* The constructor of this class is not exposed to users directly.
|
|
576
|
+
* @since v18.2.0, v16.17.0
|
|
577
|
+
*/
|
|
578
|
+
class PerformanceResourceTiming extends PerformanceEntry {
|
|
579
|
+
readonly entryType: "resource";
|
|
580
|
+
protected constructor();
|
|
581
|
+
/**
|
|
582
|
+
* The high resolution millisecond timestamp at immediately before dispatching the `fetch`
|
|
583
|
+
* request. If the resource is not intercepted by a worker the property will always return 0.
|
|
584
|
+
* @since v18.2.0, v16.17.0
|
|
585
|
+
*/
|
|
586
|
+
readonly workerStart: number;
|
|
587
|
+
/**
|
|
588
|
+
* The high resolution millisecond timestamp that represents the start time of the fetch which
|
|
589
|
+
* initiates the redirect.
|
|
590
|
+
* @since v18.2.0, v16.17.0
|
|
591
|
+
*/
|
|
592
|
+
readonly redirectStart: number;
|
|
593
|
+
/**
|
|
594
|
+
* The high resolution millisecond timestamp that will be created immediately after receiving
|
|
595
|
+
* the last byte of the response of the last redirect.
|
|
596
|
+
* @since v18.2.0, v16.17.0
|
|
597
|
+
*/
|
|
598
|
+
readonly redirectEnd: number;
|
|
599
|
+
/**
|
|
600
|
+
* The high resolution millisecond timestamp immediately before the Node.js starts to fetch the resource.
|
|
601
|
+
* @since v18.2.0, v16.17.0
|
|
602
|
+
*/
|
|
603
|
+
readonly fetchStart: number;
|
|
604
|
+
/**
|
|
605
|
+
* The high resolution millisecond timestamp immediately before the Node.js starts the domain name lookup
|
|
606
|
+
* for the resource.
|
|
607
|
+
* @since v18.2.0, v16.17.0
|
|
608
|
+
*/
|
|
609
|
+
readonly domainLookupStart: number;
|
|
610
|
+
/**
|
|
611
|
+
* The high resolution millisecond timestamp representing the time immediately after the Node.js finished
|
|
612
|
+
* the domain name lookup for the resource.
|
|
613
|
+
* @since v18.2.0, v16.17.0
|
|
614
|
+
*/
|
|
615
|
+
readonly domainLookupEnd: number;
|
|
616
|
+
/**
|
|
617
|
+
* The high resolution millisecond timestamp representing the time immediately before Node.js starts to
|
|
618
|
+
* establish the connection to the server to retrieve the resource.
|
|
619
|
+
* @since v18.2.0, v16.17.0
|
|
620
|
+
*/
|
|
621
|
+
readonly connectStart: number;
|
|
622
|
+
/**
|
|
623
|
+
* The high resolution millisecond timestamp representing the time immediately after Node.js finishes
|
|
624
|
+
* establishing the connection to the server to retrieve the resource.
|
|
625
|
+
* @since v18.2.0, v16.17.0
|
|
626
|
+
*/
|
|
627
|
+
readonly connectEnd: number;
|
|
628
|
+
/**
|
|
629
|
+
* The high resolution millisecond timestamp representing the time immediately before Node.js starts the
|
|
630
|
+
* handshake process to secure the current connection.
|
|
631
|
+
* @since v18.2.0, v16.17.0
|
|
632
|
+
*/
|
|
633
|
+
readonly secureConnectionStart: number;
|
|
634
|
+
/**
|
|
635
|
+
* The high resolution millisecond timestamp representing the time immediately before Node.js receives the
|
|
636
|
+
* first byte of the response from the server.
|
|
637
|
+
* @since v18.2.0, v16.17.0
|
|
638
|
+
*/
|
|
639
|
+
readonly requestStart: number;
|
|
640
|
+
/**
|
|
641
|
+
* The high resolution millisecond timestamp representing the time immediately after Node.js receives the
|
|
642
|
+
* last byte of the resource or immediately before the transport connection is closed, whichever comes first.
|
|
643
|
+
* @since v18.2.0, v16.17.0
|
|
644
|
+
*/
|
|
645
|
+
readonly responseEnd: number;
|
|
646
|
+
/**
|
|
647
|
+
* A number representing the size (in octets) of the fetched resource. The size includes the response header
|
|
648
|
+
* fields plus the response payload body.
|
|
649
|
+
* @since v18.2.0, v16.17.0
|
|
650
|
+
*/
|
|
651
|
+
readonly transferSize: number;
|
|
652
|
+
/**
|
|
653
|
+
* A number representing the size (in octets) received from the fetch (HTTP or cache), of the payload body, before
|
|
654
|
+
* removing any applied content-codings.
|
|
655
|
+
* @since v18.2.0, v16.17.0
|
|
656
|
+
*/
|
|
657
|
+
readonly encodedBodySize: number;
|
|
658
|
+
/**
|
|
659
|
+
* A number representing the size (in octets) received from the fetch (HTTP or cache), of the message body, after
|
|
660
|
+
* removing any applied content-codings.
|
|
661
|
+
* @since v18.2.0, v16.17.0
|
|
662
|
+
*/
|
|
663
|
+
readonly decodedBodySize: number;
|
|
664
|
+
/**
|
|
665
|
+
* Returns a `object` that is the JSON representation of the `PerformanceResourceTiming` object
|
|
666
|
+
* @since v18.2.0, v16.17.0
|
|
667
|
+
*/
|
|
668
|
+
toJSON(): any;
|
|
471
669
|
}
|
|
472
670
|
namespace constants {
|
|
473
671
|
const NODE_PERFORMANCE_GC_MAJOR: number;
|
|
@@ -493,10 +691,15 @@ declare module "perf_hooks" {
|
|
|
493
691
|
}
|
|
494
692
|
interface Histogram {
|
|
495
693
|
/**
|
|
496
|
-
*
|
|
497
|
-
* @since
|
|
694
|
+
* The number of samples recorded by the histogram.
|
|
695
|
+
* @since v17.4.0, v16.14.0
|
|
498
696
|
*/
|
|
499
|
-
readonly
|
|
697
|
+
readonly count: number;
|
|
698
|
+
/**
|
|
699
|
+
* The number of samples recorded by the histogram.
|
|
700
|
+
* v17.4.0, v16.14.0
|
|
701
|
+
*/
|
|
702
|
+
readonly countBigInt: bigint;
|
|
500
703
|
/**
|
|
501
704
|
* The number of times the event loop delay exceeded the maximum 1 hour event
|
|
502
705
|
* loop delay threshold.
|
|
@@ -504,36 +707,67 @@ declare module "perf_hooks" {
|
|
|
504
707
|
*/
|
|
505
708
|
readonly exceeds: number;
|
|
506
709
|
/**
|
|
507
|
-
* The
|
|
508
|
-
* @since
|
|
710
|
+
* The number of times the event loop delay exceeded the maximum 1 hour event loop delay threshold.
|
|
711
|
+
* @since v17.4.0, v16.14.0
|
|
509
712
|
*/
|
|
510
|
-
readonly
|
|
713
|
+
readonly exceedsBigInt: bigint;
|
|
511
714
|
/**
|
|
512
715
|
* The maximum recorded event loop delay.
|
|
513
716
|
* @since v11.10.0
|
|
514
717
|
*/
|
|
515
718
|
readonly max: number;
|
|
719
|
+
/**
|
|
720
|
+
* The maximum recorded event loop delay.
|
|
721
|
+
* v17.4.0, v16.14.0
|
|
722
|
+
*/
|
|
723
|
+
readonly maxBigInt: number;
|
|
516
724
|
/**
|
|
517
725
|
* The mean of the recorded event loop delays.
|
|
518
726
|
* @since v11.10.0
|
|
519
727
|
*/
|
|
520
728
|
readonly mean: number;
|
|
521
729
|
/**
|
|
522
|
-
* The
|
|
730
|
+
* The minimum recorded event loop delay.
|
|
523
731
|
* @since v11.10.0
|
|
524
732
|
*/
|
|
525
|
-
readonly
|
|
733
|
+
readonly min: number;
|
|
526
734
|
/**
|
|
527
|
-
*
|
|
528
|
-
*
|
|
735
|
+
* The minimum recorded event loop delay.
|
|
736
|
+
* v17.4.0, v16.14.0
|
|
529
737
|
*/
|
|
530
|
-
|
|
738
|
+
readonly minBigInt: bigint;
|
|
531
739
|
/**
|
|
532
740
|
* Returns the value at the given percentile.
|
|
533
741
|
* @since v11.10.0
|
|
534
742
|
* @param percentile A percentile value in the range (0, 100].
|
|
535
743
|
*/
|
|
536
744
|
percentile(percentile: number): number;
|
|
745
|
+
/**
|
|
746
|
+
* Returns the value at the given percentile.
|
|
747
|
+
* @since v17.4.0, v16.14.0
|
|
748
|
+
* @param percentile A percentile value in the range (0, 100].
|
|
749
|
+
*/
|
|
750
|
+
percentileBigInt(percentile: number): bigint;
|
|
751
|
+
/**
|
|
752
|
+
* Returns a `Map` object detailing the accumulated percentile distribution.
|
|
753
|
+
* @since v11.10.0
|
|
754
|
+
*/
|
|
755
|
+
readonly percentiles: Map<number, number>;
|
|
756
|
+
/**
|
|
757
|
+
* Returns a `Map` object detailing the accumulated percentile distribution.
|
|
758
|
+
* @since v17.4.0, v16.14.0
|
|
759
|
+
*/
|
|
760
|
+
readonly percentilesBigInt: Map<bigint, bigint>;
|
|
761
|
+
/**
|
|
762
|
+
* Resets the collected histogram data.
|
|
763
|
+
* @since v11.10.0
|
|
764
|
+
*/
|
|
765
|
+
reset(): void;
|
|
766
|
+
/**
|
|
767
|
+
* The standard deviation of the recorded event loop delays.
|
|
768
|
+
* @since v11.10.0
|
|
769
|
+
*/
|
|
770
|
+
readonly stddev: number;
|
|
537
771
|
}
|
|
538
772
|
interface IntervalHistogram extends Histogram {
|
|
539
773
|
/**
|
|
@@ -548,6 +782,20 @@ declare module "perf_hooks" {
|
|
|
548
782
|
* @since v11.10.0
|
|
549
783
|
*/
|
|
550
784
|
disable(): boolean;
|
|
785
|
+
/**
|
|
786
|
+
* Disables the update interval timer when the histogram is disposed.
|
|
787
|
+
*
|
|
788
|
+
* ```js
|
|
789
|
+
* const { monitorEventLoopDelay } = require('node:perf_hooks');
|
|
790
|
+
* {
|
|
791
|
+
* using hist = monitorEventLoopDelay({ resolution: 20 });
|
|
792
|
+
* hist.enable();
|
|
793
|
+
* // The histogram will be disabled when the block is exited.
|
|
794
|
+
* }
|
|
795
|
+
* ```
|
|
796
|
+
* @since v24.2.0
|
|
797
|
+
*/
|
|
798
|
+
[Symbol.dispose](): void;
|
|
551
799
|
}
|
|
552
800
|
interface RecordableHistogram extends Histogram {
|
|
553
801
|
/**
|
|
@@ -558,8 +806,6 @@ declare module "perf_hooks" {
|
|
|
558
806
|
/**
|
|
559
807
|
* Calculates the amount of time (in nanoseconds) that has passed since the
|
|
560
808
|
* previous call to `recordDelta()` and records that amount in the histogram.
|
|
561
|
-
*
|
|
562
|
-
* ## Examples
|
|
563
809
|
* @since v15.9.0, v14.18.0
|
|
564
810
|
*/
|
|
565
811
|
recordDelta(): void;
|
|
@@ -569,6 +815,83 @@ declare module "perf_hooks" {
|
|
|
569
815
|
*/
|
|
570
816
|
add(other: RecordableHistogram): void;
|
|
571
817
|
}
|
|
818
|
+
interface CreateHistogramOptions {
|
|
819
|
+
/**
|
|
820
|
+
* The lowest discernible value. Must be an integer value greater than 0.
|
|
821
|
+
* @default 1
|
|
822
|
+
*/
|
|
823
|
+
lowest?: number | bigint | undefined;
|
|
824
|
+
/**
|
|
825
|
+
* The highest recordable value. Must be an integer value that is equal to
|
|
826
|
+
* or greater than two times `lowest`.
|
|
827
|
+
* @default Number.MAX_SAFE_INTEGER
|
|
828
|
+
*/
|
|
829
|
+
highest?: number | bigint | undefined;
|
|
830
|
+
/**
|
|
831
|
+
* The number of accuracy digits. Must be a number between `1` and `5`.
|
|
832
|
+
* @default 3
|
|
833
|
+
*/
|
|
834
|
+
figures?: number | undefined;
|
|
835
|
+
}
|
|
836
|
+
/**
|
|
837
|
+
* Returns a {@link RecordableHistogram `RecordableHistogram`}.
|
|
838
|
+
* @since v15.9.0, v14.18.0
|
|
839
|
+
*/
|
|
840
|
+
function createHistogram(options?: CreateHistogramOptions): RecordableHistogram;
|
|
841
|
+
/**
|
|
842
|
+
* The `eventLoopUtilization()` function returns an object that contains the
|
|
843
|
+
* cumulative duration of time the event loop has been both idle and active as a
|
|
844
|
+
* high resolution milliseconds timer. The `utilization` value is the calculated
|
|
845
|
+
* Event Loop Utilization (ELU).
|
|
846
|
+
*
|
|
847
|
+
* If bootstrapping has not yet finished on the main thread the properties have
|
|
848
|
+
* the value of `0`. The ELU is immediately available on
|
|
849
|
+
* [Worker threads](https://nodejs.org/docs/latest-v24.x/api/worker_threads.html#worker-threads)
|
|
850
|
+
* since bootstrap happens within the event loop.
|
|
851
|
+
*
|
|
852
|
+
* Both `utilization1` and `utilization2` are optional parameters.
|
|
853
|
+
*
|
|
854
|
+
* If `utilization1` is passed, then the delta between the current call's `active`
|
|
855
|
+
* and `idle` times, as well as the corresponding `utilization` value are
|
|
856
|
+
* calculated and returned (similar to `process.hrtime()`).
|
|
857
|
+
*
|
|
858
|
+
* If `utilization1` and `utilization2` are both passed, then the delta is
|
|
859
|
+
* calculated between the two arguments. This is a convenience option because,
|
|
860
|
+
* unlike `process.hrtime()`, calculating the ELU is more complex than a
|
|
861
|
+
* single subtraction.
|
|
862
|
+
*
|
|
863
|
+
* ELU is similar to CPU utilization, except that it only measures event loop
|
|
864
|
+
* statistics and not CPU usage. It represents the percentage of time the event
|
|
865
|
+
* loop has spent outside the event loop's event provider (e.g. `epoll_wait`).
|
|
866
|
+
* No other CPU idle time is taken into consideration. The following is an example
|
|
867
|
+
* of how a mostly idle process will have a high ELU.
|
|
868
|
+
*
|
|
869
|
+
* ```js
|
|
870
|
+
* import { eventLoopUtilization } from 'node:perf_hooks';
|
|
871
|
+
* import { spawnSync } from 'node:child_process';
|
|
872
|
+
*
|
|
873
|
+
* setImmediate(() => {
|
|
874
|
+
* const elu = eventLoopUtilization();
|
|
875
|
+
* spawnSync('sleep', ['5']);
|
|
876
|
+
* console.log(eventLoopUtilization(elu).utilization);
|
|
877
|
+
* });
|
|
878
|
+
* ```
|
|
879
|
+
*
|
|
880
|
+
* Although the CPU is mostly idle while running this script, the value of `utilization`
|
|
881
|
+
* is `1`. This is because the call to `child_process.spawnSync()` blocks the event loop
|
|
882
|
+
* from proceeding.
|
|
883
|
+
*
|
|
884
|
+
* Passing in a user-defined object instead of the result of a previous call to
|
|
885
|
+
* `eventLoopUtilization()` will lead to undefined behavior. The return values are not
|
|
886
|
+
* guaranteed to reflect any correct state of the event loop.
|
|
887
|
+
* @since v24.12.0
|
|
888
|
+
* @param utilization1 The result of a previous call to `eventLoopUtilization()`.
|
|
889
|
+
* @param utilization2 The result of a previous call to `eventLoopUtilization()` prior to `utilization1`.
|
|
890
|
+
*/
|
|
891
|
+
function eventLoopUtilization(
|
|
892
|
+
utilization1?: EventLoopUtilization,
|
|
893
|
+
utilization2?: EventLoopUtilization,
|
|
894
|
+
): EventLoopUtilization;
|
|
572
895
|
/**
|
|
573
896
|
* _This property is an extension by Node.js. It is not available in Web browsers._
|
|
574
897
|
*
|
|
@@ -582,7 +905,7 @@ declare module "perf_hooks" {
|
|
|
582
905
|
* detect.
|
|
583
906
|
*
|
|
584
907
|
* ```js
|
|
585
|
-
*
|
|
908
|
+
* import { monitorEventLoopDelay } from 'node:perf_hooks';
|
|
586
909
|
* const h = monitorEventLoopDelay({ resolution: 20 });
|
|
587
910
|
* h.enable();
|
|
588
911
|
* // Do something.
|
|
@@ -598,33 +921,113 @@ declare module "perf_hooks" {
|
|
|
598
921
|
* @since v11.10.0
|
|
599
922
|
*/
|
|
600
923
|
function monitorEventLoopDelay(options?: EventLoopMonitorOptions): IntervalHistogram;
|
|
601
|
-
|
|
924
|
+
/**
|
|
925
|
+
* _This property is an extension by Node.js. It is not available in Web browsers._
|
|
926
|
+
*
|
|
927
|
+
* Wraps a function within a new function that measures the running time of the
|
|
928
|
+
* wrapped function. A `PerformanceObserver` must be subscribed to the `'function'`
|
|
929
|
+
* event type in order for the timing details to be accessed.
|
|
930
|
+
*
|
|
931
|
+
* ```js
|
|
932
|
+
* import { timerify, performance, PerformanceObserver } from 'node:perf_hooks';
|
|
933
|
+
*
|
|
934
|
+
* function someFunction() {
|
|
935
|
+
* console.log('hello world');
|
|
936
|
+
* }
|
|
937
|
+
*
|
|
938
|
+
* const wrapped = timerify(someFunction);
|
|
939
|
+
*
|
|
940
|
+
* const obs = new PerformanceObserver((list) => {
|
|
941
|
+
* console.log(list.getEntries()[0].duration);
|
|
942
|
+
*
|
|
943
|
+
* performance.clearMarks();
|
|
944
|
+
* performance.clearMeasures();
|
|
945
|
+
* obs.disconnect();
|
|
946
|
+
* });
|
|
947
|
+
* obs.observe({ entryTypes: ['function'] });
|
|
948
|
+
*
|
|
949
|
+
* // A performance timeline entry will be created
|
|
950
|
+
* wrapped();
|
|
951
|
+
* ```
|
|
952
|
+
*
|
|
953
|
+
* If the wrapped function returns a promise, a finally handler will be attached
|
|
954
|
+
* to the promise and the duration will be reported once the finally handler is invoked.
|
|
955
|
+
* @since v24.12.0
|
|
956
|
+
*/
|
|
957
|
+
function timerify<T extends (...params: any[]) => any>(fn: T, options?: TimerifyOptions): T;
|
|
958
|
+
import {
|
|
959
|
+
performance as _performance,
|
|
960
|
+
PerformanceEntry as _PerformanceEntry,
|
|
961
|
+
PerformanceMark as _PerformanceMark,
|
|
962
|
+
PerformanceMeasure as _PerformanceMeasure,
|
|
963
|
+
PerformanceObserver as _PerformanceObserver,
|
|
964
|
+
PerformanceObserverEntryList as _PerformanceObserverEntryList,
|
|
965
|
+
PerformanceResourceTiming as _PerformanceResourceTiming,
|
|
966
|
+
} from "perf_hooks";
|
|
967
|
+
global {
|
|
602
968
|
/**
|
|
603
|
-
*
|
|
604
|
-
* @
|
|
969
|
+
* `PerformanceEntry` is a global reference for `import { PerformanceEntry } from 'node:perf_hooks'`
|
|
970
|
+
* @see https://nodejs.org/docs/latest-v24.x/api/globals.html#performanceentry
|
|
971
|
+
* @since v19.0.0
|
|
605
972
|
*/
|
|
606
|
-
|
|
973
|
+
var PerformanceEntry: typeof globalThis extends {
|
|
974
|
+
onmessage: any;
|
|
975
|
+
PerformanceEntry: infer T;
|
|
976
|
+
} ? T
|
|
977
|
+
: typeof _PerformanceEntry;
|
|
607
978
|
/**
|
|
608
|
-
*
|
|
609
|
-
* @
|
|
979
|
+
* `PerformanceMark` is a global reference for `import { PerformanceMark } from 'node:perf_hooks'`
|
|
980
|
+
* @see https://nodejs.org/docs/latest-v24.x/api/globals.html#performancemark
|
|
981
|
+
* @since v19.0.0
|
|
610
982
|
*/
|
|
611
|
-
|
|
983
|
+
var PerformanceMark: typeof globalThis extends {
|
|
984
|
+
onmessage: any;
|
|
985
|
+
PerformanceMark: infer T;
|
|
986
|
+
} ? T
|
|
987
|
+
: typeof _PerformanceMark;
|
|
612
988
|
/**
|
|
613
|
-
*
|
|
614
|
-
* @
|
|
989
|
+
* `PerformanceMeasure` is a global reference for `import { PerformanceMeasure } from 'node:perf_hooks'`
|
|
990
|
+
* @see https://nodejs.org/docs/latest-v24.x/api/globals.html#performancemeasure
|
|
991
|
+
* @since v19.0.0
|
|
615
992
|
*/
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
993
|
+
var PerformanceMeasure: typeof globalThis extends {
|
|
994
|
+
onmessage: any;
|
|
995
|
+
PerformanceMeasure: infer T;
|
|
996
|
+
} ? T
|
|
997
|
+
: typeof _PerformanceMeasure;
|
|
998
|
+
/**
|
|
999
|
+
* `PerformanceObserver` is a global reference for `import { PerformanceObserver } from 'node:perf_hooks'`
|
|
1000
|
+
* @see https://nodejs.org/docs/latest-v24.x/api/globals.html#performanceobserver
|
|
1001
|
+
* @since v19.0.0
|
|
1002
|
+
*/
|
|
1003
|
+
var PerformanceObserver: typeof globalThis extends {
|
|
1004
|
+
onmessage: any;
|
|
1005
|
+
PerformanceObserver: infer T;
|
|
1006
|
+
} ? T
|
|
1007
|
+
: typeof _PerformanceObserver;
|
|
1008
|
+
/**
|
|
1009
|
+
* `PerformanceObserverEntryList` is a global reference for `import { PerformanceObserverEntryList } from 'node:perf_hooks'`
|
|
1010
|
+
* @see https://nodejs.org/docs/latest-v24.x/api/globals.html#performanceobserverentrylist
|
|
1011
|
+
* @since v19.0.0
|
|
1012
|
+
*/
|
|
1013
|
+
var PerformanceObserverEntryList: typeof globalThis extends {
|
|
1014
|
+
onmessage: any;
|
|
1015
|
+
PerformanceObserverEntryList: infer T;
|
|
1016
|
+
} ? T
|
|
1017
|
+
: typeof _PerformanceObserverEntryList;
|
|
1018
|
+
/**
|
|
1019
|
+
* `PerformanceResourceTiming` is a global reference for `import { PerformanceResourceTiming } from 'node:perf_hooks'`
|
|
1020
|
+
* @see https://nodejs.org/docs/latest-v24.x/api/globals.html#performanceresourcetiming
|
|
1021
|
+
* @since v19.0.0
|
|
1022
|
+
*/
|
|
1023
|
+
var PerformanceResourceTiming: typeof globalThis extends {
|
|
1024
|
+
onmessage: any;
|
|
1025
|
+
PerformanceResourceTiming: infer T;
|
|
1026
|
+
} ? T
|
|
1027
|
+
: typeof _PerformanceResourceTiming;
|
|
625
1028
|
/**
|
|
626
|
-
* `performance` is a global reference for `
|
|
627
|
-
* https://nodejs.org/api/globals.html#performance
|
|
1029
|
+
* `performance` is a global reference for `import { performance } from 'node:perf_hooks'`
|
|
1030
|
+
* @see https://nodejs.org/docs/latest-v24.x/api/globals.html#performance
|
|
628
1031
|
* @since v16.0.0
|
|
629
1032
|
*/
|
|
630
1033
|
var performance: typeof globalThis extends {
|