m06_task3.js 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (204) hide show
  1. package/.idea/.name +1 -0
  2. package/.idea/inspectionProfiles/Project_Default.xml +10 -0
  3. package/.idea/jsLibraryMappings.xml +6 -0
  4. package/.idea/modules.xml +8 -0
  5. package/.idea/node_lab_6.iml +12 -0
  6. package/06_task2.html +73 -0
  7. package/06_task2.js +52 -0
  8. package/06_task3.js +3 -0
  9. package/06_task4.js +3 -0
  10. package/m06_task3.js +28 -0
  11. package/package/index.js +28 -0
  12. package/package/node_modules/.package-lock.json +31 -0
  13. package/package/node_modules/@types/node/LICENSE +21 -0
  14. package/package/node_modules/@types/node/README.md +16 -0
  15. package/package/node_modules/@types/node/assert/strict.d.ts +8 -0
  16. package/package/node_modules/@types/node/assert.d.ts +961 -0
  17. package/package/node_modules/@types/node/async_hooks.d.ts +501 -0
  18. package/package/node_modules/@types/node/buffer.d.ts +2258 -0
  19. package/package/node_modules/@types/node/child_process.d.ts +1369 -0
  20. package/package/node_modules/@types/node/cluster.d.ts +410 -0
  21. package/package/node_modules/@types/node/console.d.ts +412 -0
  22. package/package/node_modules/@types/node/constants.d.ts +18 -0
  23. package/package/node_modules/@types/node/crypto.d.ts +3964 -0
  24. package/package/node_modules/@types/node/dgram.d.ts +545 -0
  25. package/package/node_modules/@types/node/diagnostics_channel.d.ts +153 -0
  26. package/package/node_modules/@types/node/dns/promises.d.ts +370 -0
  27. package/package/node_modules/@types/node/dns.d.ts +659 -0
  28. package/package/node_modules/@types/node/dom-events.d.ts +126 -0
  29. package/package/node_modules/@types/node/domain.d.ts +170 -0
  30. package/package/node_modules/@types/node/events.d.ts +678 -0
  31. package/package/node_modules/@types/node/fs/promises.d.ts +1138 -0
  32. package/package/node_modules/@types/node/fs.d.ts +3872 -0
  33. package/package/node_modules/@types/node/globals.d.ts +300 -0
  34. package/package/node_modules/@types/node/globals.global.d.ts +1 -0
  35. package/package/node_modules/@types/node/http.d.ts +1614 -0
  36. package/package/node_modules/@types/node/http2.d.ts +2134 -0
  37. package/package/node_modules/@types/node/https.d.ts +541 -0
  38. package/package/node_modules/@types/node/index.d.ts +133 -0
  39. package/package/node_modules/@types/node/inspector.d.ts +2741 -0
  40. package/package/node_modules/@types/node/module.d.ts +114 -0
  41. package/package/node_modules/@types/node/net.d.ts +869 -0
  42. package/package/node_modules/@types/node/os.d.ts +466 -0
  43. package/package/node_modules/@types/node/package.json +232 -0
  44. package/package/node_modules/@types/node/path.d.ts +191 -0
  45. package/package/node_modules/@types/node/perf_hooks.d.ts +625 -0
  46. package/package/node_modules/@types/node/process.d.ts +1482 -0
  47. package/package/node_modules/@types/node/punycode.d.ts +117 -0
  48. package/package/node_modules/@types/node/querystring.d.ts +131 -0
  49. package/package/node_modules/@types/node/readline/promises.d.ts +143 -0
  50. package/package/node_modules/@types/node/readline.d.ts +653 -0
  51. package/package/node_modules/@types/node/repl.d.ts +424 -0
  52. package/package/node_modules/@types/node/stream/consumers.d.ts +12 -0
  53. package/package/node_modules/@types/node/stream/promises.d.ts +42 -0
  54. package/package/node_modules/@types/node/stream/web.d.ts +330 -0
  55. package/package/node_modules/@types/node/stream.d.ts +1340 -0
  56. package/package/node_modules/@types/node/string_decoder.d.ts +67 -0
  57. package/package/node_modules/@types/node/test.d.ts +314 -0
  58. package/package/node_modules/@types/node/timers/promises.d.ts +68 -0
  59. package/package/node_modules/@types/node/timers.d.ts +94 -0
  60. package/package/node_modules/@types/node/tls.d.ts +1028 -0
  61. package/package/node_modules/@types/node/trace_events.d.ts +171 -0
  62. package/package/node_modules/@types/node/ts4.8/assert/strict.d.ts +8 -0
  63. package/package/node_modules/@types/node/ts4.8/assert.d.ts +961 -0
  64. package/package/node_modules/@types/node/ts4.8/async_hooks.d.ts +501 -0
  65. package/package/node_modules/@types/node/ts4.8/buffer.d.ts +2259 -0
  66. package/package/node_modules/@types/node/ts4.8/child_process.d.ts +1369 -0
  67. package/package/node_modules/@types/node/ts4.8/cluster.d.ts +410 -0
  68. package/package/node_modules/@types/node/ts4.8/console.d.ts +412 -0
  69. package/package/node_modules/@types/node/ts4.8/constants.d.ts +18 -0
  70. package/package/node_modules/@types/node/ts4.8/crypto.d.ts +3964 -0
  71. package/package/node_modules/@types/node/ts4.8/dgram.d.ts +545 -0
  72. package/package/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +153 -0
  73. package/package/node_modules/@types/node/ts4.8/dns/promises.d.ts +370 -0
  74. package/package/node_modules/@types/node/ts4.8/dns.d.ts +659 -0
  75. package/package/node_modules/@types/node/ts4.8/dom-events.d.ts +126 -0
  76. package/package/node_modules/@types/node/ts4.8/domain.d.ts +170 -0
  77. package/package/node_modules/@types/node/ts4.8/events.d.ts +678 -0
  78. package/package/node_modules/@types/node/ts4.8/fs/promises.d.ts +1138 -0
  79. package/package/node_modules/@types/node/ts4.8/fs.d.ts +3872 -0
  80. package/package/node_modules/@types/node/ts4.8/globals.d.ts +294 -0
  81. package/package/node_modules/@types/node/ts4.8/globals.global.d.ts +1 -0
  82. package/package/node_modules/@types/node/ts4.8/http.d.ts +1614 -0
  83. package/package/node_modules/@types/node/ts4.8/http2.d.ts +2134 -0
  84. package/package/node_modules/@types/node/ts4.8/https.d.ts +541 -0
  85. package/package/node_modules/@types/node/ts4.8/index.d.ts +88 -0
  86. package/package/node_modules/@types/node/ts4.8/inspector.d.ts +2741 -0
  87. package/package/node_modules/@types/node/ts4.8/module.d.ts +114 -0
  88. package/package/node_modules/@types/node/ts4.8/net.d.ts +869 -0
  89. package/package/node_modules/@types/node/ts4.8/os.d.ts +466 -0
  90. package/package/node_modules/@types/node/ts4.8/path.d.ts +191 -0
  91. package/package/node_modules/@types/node/ts4.8/perf_hooks.d.ts +625 -0
  92. package/package/node_modules/@types/node/ts4.8/process.d.ts +1482 -0
  93. package/package/node_modules/@types/node/ts4.8/punycode.d.ts +117 -0
  94. package/package/node_modules/@types/node/ts4.8/querystring.d.ts +131 -0
  95. package/package/node_modules/@types/node/ts4.8/readline/promises.d.ts +143 -0
  96. package/package/node_modules/@types/node/ts4.8/readline.d.ts +653 -0
  97. package/package/node_modules/@types/node/ts4.8/repl.d.ts +424 -0
  98. package/package/node_modules/@types/node/ts4.8/stream/consumers.d.ts +12 -0
  99. package/package/node_modules/@types/node/ts4.8/stream/promises.d.ts +42 -0
  100. package/package/node_modules/@types/node/ts4.8/stream/web.d.ts +330 -0
  101. package/package/node_modules/@types/node/ts4.8/stream.d.ts +1340 -0
  102. package/package/node_modules/@types/node/ts4.8/string_decoder.d.ts +67 -0
  103. package/package/node_modules/@types/node/ts4.8/test.d.ts +314 -0
  104. package/package/node_modules/@types/node/ts4.8/timers/promises.d.ts +68 -0
  105. package/package/node_modules/@types/node/ts4.8/timers.d.ts +94 -0
  106. package/package/node_modules/@types/node/ts4.8/tls.d.ts +1028 -0
  107. package/package/node_modules/@types/node/ts4.8/trace_events.d.ts +171 -0
  108. package/package/node_modules/@types/node/ts4.8/tty.d.ts +206 -0
  109. package/package/node_modules/@types/node/ts4.8/url.d.ts +897 -0
  110. package/package/node_modules/@types/node/ts4.8/util.d.ts +1850 -0
  111. package/package/node_modules/@types/node/ts4.8/v8.d.ts +396 -0
  112. package/package/node_modules/@types/node/ts4.8/vm.d.ts +509 -0
  113. package/package/node_modules/@types/node/ts4.8/wasi.d.ts +158 -0
  114. package/package/node_modules/@types/node/ts4.8/worker_threads.d.ts +689 -0
  115. package/package/node_modules/@types/node/ts4.8/zlib.d.ts +517 -0
  116. package/package/node_modules/@types/node/tty.d.ts +206 -0
  117. package/package/node_modules/@types/node/url.d.ts +897 -0
  118. package/package/node_modules/@types/node/util.d.ts +1850 -0
  119. package/package/node_modules/@types/node/v8.d.ts +396 -0
  120. package/package/node_modules/@types/node/vm.d.ts +509 -0
  121. package/package/node_modules/@types/node/wasi.d.ts +158 -0
  122. package/package/node_modules/@types/node/worker_threads.d.ts +689 -0
  123. package/package/node_modules/@types/node/zlib.d.ts +517 -0
  124. package/package/node_modules/@types/nodemailer/LICENSE +21 -0
  125. package/package/node_modules/@types/nodemailer/README.md +16 -0
  126. package/package/node_modules/@types/nodemailer/index.d.ts +83 -0
  127. package/package/node_modules/@types/nodemailer/lib/addressparser/index.d.ts +31 -0
  128. package/package/node_modules/@types/nodemailer/lib/base64/index.d.ts +22 -0
  129. package/package/node_modules/@types/nodemailer/lib/dkim/index.d.ts +45 -0
  130. package/package/node_modules/@types/nodemailer/lib/dkim/message-parser.d.ts +75 -0
  131. package/package/node_modules/@types/nodemailer/lib/dkim/relaxed-body.d.ts +75 -0
  132. package/package/node_modules/@types/nodemailer/lib/dkim/sign.d.ts +11 -0
  133. package/package/node_modules/@types/nodemailer/lib/fetch/cookies.d.ts +54 -0
  134. package/package/node_modules/@types/nodemailer/lib/fetch/index.d.ts +38 -0
  135. package/package/node_modules/@types/nodemailer/lib/json-transport/index.d.ts +50 -0
  136. package/package/node_modules/@types/nodemailer/lib/mail-composer/index.d.ts +25 -0
  137. package/package/node_modules/@types/nodemailer/lib/mailer/index.d.ts +230 -0
  138. package/package/node_modules/@types/nodemailer/lib/mailer/mail-message.d.ts +28 -0
  139. package/package/node_modules/@types/nodemailer/lib/mime-funcs/index.d.ts +87 -0
  140. package/package/node_modules/@types/nodemailer/lib/mime-funcs/mime-types.d.ts +2 -0
  141. package/package/node_modules/@types/nodemailer/lib/mime-node/index.d.ts +137 -0
  142. package/package/node_modules/@types/nodemailer/lib/mime-node/last-newline.d.ts +9 -0
  143. package/package/node_modules/@types/nodemailer/lib/qp/index.d.ts +23 -0
  144. package/package/node_modules/@types/nodemailer/lib/sendmail-transport/index.d.ts +53 -0
  145. package/package/node_modules/@types/nodemailer/lib/sendmail-transport/le-unix.d.ts +7 -0
  146. package/package/node_modules/@types/nodemailer/lib/sendmail-transport/le-windows.d.ts +7 -0
  147. package/package/node_modules/@types/nodemailer/lib/ses-transport/index.d.ts +136 -0
  148. package/package/node_modules/@types/nodemailer/lib/shared/index.d.ts +51 -0
  149. package/package/node_modules/@types/nodemailer/lib/smtp-connection/data-stream.d.ts +11 -0
  150. package/package/node_modules/@types/nodemailer/lib/smtp-connection/http-proxy-client.d.ts +11 -0
  151. package/package/node_modules/@types/nodemailer/lib/smtp-connection/index.d.ts +254 -0
  152. package/package/node_modules/@types/nodemailer/lib/smtp-pool/index.d.ts +90 -0
  153. package/package/node_modules/@types/nodemailer/lib/smtp-pool/pool-resource.d.ts +66 -0
  154. package/package/node_modules/@types/nodemailer/lib/smtp-transport/index.d.ts +115 -0
  155. package/package/node_modules/@types/nodemailer/lib/stream-transport/index.d.ts +56 -0
  156. package/package/node_modules/@types/nodemailer/lib/well-known/index.d.ts +6 -0
  157. package/package/node_modules/@types/nodemailer/lib/xoauth2/index.d.ts +110 -0
  158. package/package/node_modules/@types/nodemailer/package.json +37 -0
  159. package/package/node_modules/nodemailer/.gitattributes +6 -0
  160. package/package/node_modules/nodemailer/.prettierrc.js +8 -0
  161. package/package/node_modules/nodemailer/CHANGELOG.md +715 -0
  162. package/package/node_modules/nodemailer/CODE_OF_CONDUCT.md +76 -0
  163. package/package/node_modules/nodemailer/CONTRIBUTING.md +67 -0
  164. package/package/node_modules/nodemailer/LICENSE +16 -0
  165. package/package/node_modules/nodemailer/README.md +93 -0
  166. package/package/node_modules/nodemailer/SECURITY.txt +22 -0
  167. package/package/node_modules/nodemailer/lib/addressparser/index.js +313 -0
  168. package/package/node_modules/nodemailer/lib/base64/index.js +142 -0
  169. package/package/node_modules/nodemailer/lib/dkim/index.js +251 -0
  170. package/package/node_modules/nodemailer/lib/dkim/message-parser.js +155 -0
  171. package/package/node_modules/nodemailer/lib/dkim/relaxed-body.js +154 -0
  172. package/package/node_modules/nodemailer/lib/dkim/sign.js +117 -0
  173. package/package/node_modules/nodemailer/lib/fetch/cookies.js +281 -0
  174. package/package/node_modules/nodemailer/lib/fetch/index.js +269 -0
  175. package/package/node_modules/nodemailer/lib/json-transport/index.js +82 -0
  176. package/package/node_modules/nodemailer/lib/mail-composer/index.js +558 -0
  177. package/package/node_modules/nodemailer/lib/mailer/index.js +427 -0
  178. package/package/node_modules/nodemailer/lib/mailer/mail-message.js +315 -0
  179. package/package/node_modules/nodemailer/lib/mime-funcs/index.js +619 -0
  180. package/package/node_modules/nodemailer/lib/mime-funcs/mime-types.js +2102 -0
  181. package/package/node_modules/nodemailer/lib/mime-node/index.js +1290 -0
  182. package/package/node_modules/nodemailer/lib/mime-node/last-newline.js +33 -0
  183. package/package/node_modules/nodemailer/lib/mime-node/le-unix.js +43 -0
  184. package/package/node_modules/nodemailer/lib/mime-node/le-windows.js +52 -0
  185. package/package/node_modules/nodemailer/lib/nodemailer.js +143 -0
  186. package/package/node_modules/nodemailer/lib/qp/index.js +219 -0
  187. package/package/node_modules/nodemailer/lib/sendmail-transport/index.js +210 -0
  188. package/package/node_modules/nodemailer/lib/ses-transport/index.js +349 -0
  189. package/package/node_modules/nodemailer/lib/shared/index.js +639 -0
  190. package/package/node_modules/nodemailer/lib/smtp-connection/data-stream.js +108 -0
  191. package/package/node_modules/nodemailer/lib/smtp-connection/http-proxy-client.js +143 -0
  192. package/package/node_modules/nodemailer/lib/smtp-connection/index.js +1786 -0
  193. package/package/node_modules/nodemailer/lib/smtp-pool/index.js +648 -0
  194. package/package/node_modules/nodemailer/lib/smtp-pool/pool-resource.js +253 -0
  195. package/package/node_modules/nodemailer/lib/smtp-transport/index.js +416 -0
  196. package/package/node_modules/nodemailer/lib/stream-transport/index.js +135 -0
  197. package/package/node_modules/nodemailer/lib/well-known/index.js +47 -0
  198. package/package/node_modules/nodemailer/lib/well-known/services.json +286 -0
  199. package/package/node_modules/nodemailer/lib/xoauth2/index.js +376 -0
  200. package/package/node_modules/nodemailer/package.json +46 -0
  201. package/package/node_modules/nodemailer/postinstall.js +101 -0
  202. package/package/package-lock.json +60 -0
  203. package/package/package.json +6 -0
  204. package/package.json +19 -0
@@ -0,0 +1,625 @@
1
+ /**
2
+ * This module provides an implementation of a subset of the W3C [Web Performance APIs](https://w3c.github.io/perf-timing-primer/) as well as additional APIs for
3
+ * Node.js-specific performance measurements.
4
+ *
5
+ * Node.js supports the following [Web Performance APIs](https://w3c.github.io/perf-timing-primer/):
6
+ *
7
+ * * [High Resolution Time](https://www.w3.org/TR/hr-time-2)
8
+ * * [Performance Timeline](https://w3c.github.io/performance-timeline/)
9
+ * * [User Timing](https://www.w3.org/TR/user-timing/)
10
+ *
11
+ * ```js
12
+ * const { PerformanceObserver, performance } = require('perf_hooks');
13
+ *
14
+ * const obs = new PerformanceObserver((items) => {
15
+ * console.log(items.getEntries()[0].duration);
16
+ * performance.clearMarks();
17
+ * });
18
+ * obs.observe({ type: 'measure' });
19
+ * performance.measure('Start to Now');
20
+ *
21
+ * performance.mark('A');
22
+ * doSomeLongRunningProcess(() => {
23
+ * performance.measure('A to Now', 'A');
24
+ *
25
+ * performance.mark('B');
26
+ * performance.measure('A to B', 'A', 'B');
27
+ * });
28
+ * ```
29
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/perf_hooks.js)
30
+ */
31
+ declare module 'perf_hooks' {
32
+ import { AsyncResource } from 'node:async_hooks';
33
+ type EntryType = 'node' | 'mark' | 'measure' | 'gc' | 'function' | 'http2' | 'http';
34
+ interface NodeGCPerformanceDetail {
35
+ /**
36
+ * When `performanceEntry.entryType` is equal to 'gc', `the performance.kind` property identifies
37
+ * the type of garbage collection operation that occurred.
38
+ * See perf_hooks.constants for valid values.
39
+ */
40
+ readonly kind?: number | undefined;
41
+ /**
42
+ * When `performanceEntry.entryType` is equal to 'gc', the `performance.flags`
43
+ * property contains additional information about garbage collection operation.
44
+ * See perf_hooks.constants for valid values.
45
+ */
46
+ readonly flags?: number | undefined;
47
+ }
48
+ /**
49
+ * @since v8.5.0
50
+ */
51
+ class PerformanceEntry {
52
+ protected constructor();
53
+ /**
54
+ * The total number of milliseconds elapsed for this entry. This value will not
55
+ * be meaningful for all Performance Entry types.
56
+ * @since v8.5.0
57
+ */
58
+ readonly duration: number;
59
+ /**
60
+ * The name of the performance entry.
61
+ * @since v8.5.0
62
+ */
63
+ readonly name: string;
64
+ /**
65
+ * The high resolution millisecond timestamp marking the starting time of the
66
+ * Performance Entry.
67
+ * @since v8.5.0
68
+ */
69
+ readonly startTime: number;
70
+ /**
71
+ * The type of the performance entry. It may be one of:
72
+ *
73
+ * * `'node'` (Node.js only)
74
+ * * `'mark'` (available on the Web)
75
+ * * `'measure'` (available on the Web)
76
+ * * `'gc'` (Node.js only)
77
+ * * `'function'` (Node.js only)
78
+ * * `'http2'` (Node.js only)
79
+ * * `'http'` (Node.js only)
80
+ * @since v8.5.0
81
+ */
82
+ readonly entryType: EntryType;
83
+ /**
84
+ * Additional detail specific to the `entryType`.
85
+ * @since v16.0.0
86
+ */
87
+ readonly detail?: NodeGCPerformanceDetail | unknown | undefined; // TODO: Narrow this based on entry type.
88
+ toJSON(): any;
89
+ }
90
+ class PerformanceMark extends PerformanceEntry {
91
+ readonly duration: 0;
92
+ readonly entryType: 'mark';
93
+ }
94
+ class PerformanceMeasure extends PerformanceEntry {
95
+ readonly entryType: 'measure';
96
+ }
97
+ /**
98
+ * _This property is an extension by Node.js. It is not available in Web browsers._
99
+ *
100
+ * Provides timing details for Node.js itself. The constructor of this class
101
+ * is not exposed to users.
102
+ * @since v8.5.0
103
+ */
104
+ class PerformanceNodeTiming extends PerformanceEntry {
105
+ /**
106
+ * The high resolution millisecond timestamp at which the Node.js process
107
+ * completed bootstrapping. If bootstrapping has not yet finished, the property
108
+ * has the value of -1.
109
+ * @since v8.5.0
110
+ */
111
+ readonly bootstrapComplete: number;
112
+ /**
113
+ * The high resolution millisecond timestamp at which the Node.js environment was
114
+ * initialized.
115
+ * @since v8.5.0
116
+ */
117
+ readonly environment: number;
118
+ /**
119
+ * The high resolution millisecond timestamp of the amount of time the event loop
120
+ * has been idle within the event loop's event provider (e.g. `epoll_wait`). This
121
+ * does not take CPU usage into consideration. If the event loop has not yet
122
+ * started (e.g., in the first tick of the main script), the property has the
123
+ * value of 0.
124
+ * @since v14.10.0, v12.19.0
125
+ */
126
+ readonly idleTime: number;
127
+ /**
128
+ * The high resolution millisecond timestamp at which the Node.js event loop
129
+ * exited. If the event loop has not yet exited, the property has the value of -1\.
130
+ * It can only have a value of not -1 in a handler of the `'exit'` event.
131
+ * @since v8.5.0
132
+ */
133
+ readonly loopExit: number;
134
+ /**
135
+ * The high resolution millisecond timestamp at which the Node.js event loop
136
+ * started. If the event loop has not yet started (e.g., in the first tick of the
137
+ * main script), the property has the value of -1.
138
+ * @since v8.5.0
139
+ */
140
+ readonly loopStart: number;
141
+ /**
142
+ * The high resolution millisecond timestamp at which the V8 platform was
143
+ * initialized.
144
+ * @since v8.5.0
145
+ */
146
+ readonly v8Start: number;
147
+ }
148
+ interface EventLoopUtilization {
149
+ idle: number;
150
+ active: number;
151
+ utilization: number;
152
+ }
153
+ /**
154
+ * @param util1 The result of a previous call to eventLoopUtilization()
155
+ * @param util2 The result of a previous call to eventLoopUtilization() prior to util1
156
+ */
157
+ type EventLoopUtilityFunction = (util1?: EventLoopUtilization, util2?: EventLoopUtilization) => EventLoopUtilization;
158
+ interface MarkOptions {
159
+ /**
160
+ * Additional optional detail to include with the mark.
161
+ */
162
+ detail?: unknown | undefined;
163
+ /**
164
+ * An optional timestamp to be used as the mark time.
165
+ * @default `performance.now()`.
166
+ */
167
+ startTime?: number | undefined;
168
+ }
169
+ interface MeasureOptions {
170
+ /**
171
+ * Additional optional detail to include with the mark.
172
+ */
173
+ detail?: unknown | undefined;
174
+ /**
175
+ * Duration between start and end times.
176
+ */
177
+ duration?: number | undefined;
178
+ /**
179
+ * Timestamp to be used as the end time, or a string identifying a previously recorded mark.
180
+ */
181
+ end?: number | string | undefined;
182
+ /**
183
+ * Timestamp to be used as the start time, or a string identifying a previously recorded mark.
184
+ */
185
+ start?: number | string | undefined;
186
+ }
187
+ interface TimerifyOptions {
188
+ /**
189
+ * A histogram object created using
190
+ * `perf_hooks.createHistogram()` that will record runtime durations in
191
+ * nanoseconds.
192
+ */
193
+ histogram?: RecordableHistogram | undefined;
194
+ }
195
+ interface Performance {
196
+ /**
197
+ * If name is not provided, removes all PerformanceMark objects from the Performance Timeline.
198
+ * If name is provided, removes only the named mark.
199
+ * @param name
200
+ */
201
+ clearMarks(name?: string): void;
202
+ /**
203
+ * If name is not provided, removes all PerformanceMeasure objects from the Performance Timeline.
204
+ * If name is provided, removes only the named measure.
205
+ * @param name
206
+ * @since v16.7.0
207
+ */
208
+ clearMeasures(name?: string): void;
209
+ /**
210
+ * Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`.
211
+ * If you are only interested in performance entries of certain types or that have certain names, see
212
+ * `performance.getEntriesByType()` and `performance.getEntriesByName()`.
213
+ * @since v16.7.0
214
+ */
215
+ getEntries(): PerformanceEntry[];
216
+ /**
217
+ * Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`
218
+ * whose `performanceEntry.name` is equal to `name`, and optionally, whose `performanceEntry.entryType` is equal to `type`.
219
+ * @param name
220
+ * @param type
221
+ * @since v16.7.0
222
+ */
223
+ getEntriesByName(name: string, type?: EntryType): PerformanceEntry[];
224
+ /**
225
+ * Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`
226
+ * whose `performanceEntry.entryType` is equal to `type`.
227
+ * @param type
228
+ * @since v16.7.0
229
+ */
230
+ getEntriesByType(type: EntryType): PerformanceEntry[];
231
+ /**
232
+ * Creates a new PerformanceMark entry in the Performance Timeline.
233
+ * A PerformanceMark is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'mark',
234
+ * and whose performanceEntry.duration is always 0.
235
+ * Performance marks are used to mark specific significant moments in the Performance Timeline.
236
+ * @param name
237
+ * @return The PerformanceMark entry that was created
238
+ */
239
+ mark(name?: string, options?: MarkOptions): PerformanceMark;
240
+ /**
241
+ * Creates a new PerformanceMeasure entry in the Performance Timeline.
242
+ * A PerformanceMeasure is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'measure',
243
+ * and whose performanceEntry.duration measures the number of milliseconds elapsed since startMark and endMark.
244
+ *
245
+ * The startMark argument may identify any existing PerformanceMark in the the Performance Timeline, or may identify
246
+ * any of the timestamp properties provided by the PerformanceNodeTiming class. If the named startMark does not exist,
247
+ * then startMark is set to timeOrigin by default.
248
+ *
249
+ * The endMark argument must identify any existing PerformanceMark in the the Performance Timeline or any of the timestamp
250
+ * properties provided by the PerformanceNodeTiming class. If the named endMark does not exist, an error will be thrown.
251
+ * @param name
252
+ * @param startMark
253
+ * @param endMark
254
+ * @return The PerformanceMeasure entry that was created
255
+ */
256
+ measure(name: string, startMark?: string, endMark?: string): PerformanceMeasure;
257
+ measure(name: string, options: MeasureOptions): PerformanceMeasure;
258
+ /**
259
+ * An instance of the PerformanceNodeTiming class that provides performance metrics for specific Node.js operational milestones.
260
+ */
261
+ readonly nodeTiming: PerformanceNodeTiming;
262
+ /**
263
+ * @return the current high resolution millisecond timestamp
264
+ */
265
+ now(): number;
266
+ /**
267
+ * The timeOrigin specifies the high resolution millisecond timestamp from which all performance metric durations are measured.
268
+ */
269
+ readonly timeOrigin: number;
270
+ /**
271
+ * Wraps a function within a new function that measures the running time of the wrapped function.
272
+ * A PerformanceObserver must be subscribed to the 'function' event type in order for the timing details to be accessed.
273
+ * @param fn
274
+ */
275
+ timerify<T extends (...params: any[]) => any>(fn: T, options?: TimerifyOptions): T;
276
+ /**
277
+ * eventLoopUtilization is similar to CPU utilization except that it is calculated using high precision wall-clock time.
278
+ * It represents the percentage of time the event loop has spent outside the event loop's event provider (e.g. epoll_wait).
279
+ * No other CPU idle time is taken into consideration.
280
+ */
281
+ eventLoopUtilization: EventLoopUtilityFunction;
282
+ }
283
+ interface PerformanceObserverEntryList {
284
+ /**
285
+ * Returns a list of `PerformanceEntry` objects in chronological order
286
+ * with respect to `performanceEntry.startTime`.
287
+ *
288
+ * ```js
289
+ * const {
290
+ * performance,
291
+ * PerformanceObserver
292
+ * } = require('perf_hooks');
293
+ *
294
+ * const obs = new PerformanceObserver((perfObserverList, observer) => {
295
+ * console.log(perfObserverList.getEntries());
296
+ *
297
+ * * [
298
+ * * PerformanceEntry {
299
+ * * name: 'test',
300
+ * * entryType: 'mark',
301
+ * * startTime: 81.465639,
302
+ * * duration: 0
303
+ * * },
304
+ * * PerformanceEntry {
305
+ * * name: 'meow',
306
+ * * entryType: 'mark',
307
+ * * startTime: 81.860064,
308
+ * * duration: 0
309
+ * * }
310
+ * * ]
311
+ *
312
+ *
313
+ * performance.clearMarks();
314
+ * performance.clearMeasures();
315
+ * observer.disconnect();
316
+ * });
317
+ * obs.observe({ type: 'mark' });
318
+ *
319
+ * performance.mark('test');
320
+ * performance.mark('meow');
321
+ * ```
322
+ * @since v8.5.0
323
+ */
324
+ getEntries(): PerformanceEntry[];
325
+ /**
326
+ * Returns a list of `PerformanceEntry` objects in chronological order
327
+ * with respect to `performanceEntry.startTime` whose `performanceEntry.name` is
328
+ * equal to `name`, and optionally, whose `performanceEntry.entryType` is equal to`type`.
329
+ *
330
+ * ```js
331
+ * const {
332
+ * performance,
333
+ * PerformanceObserver
334
+ * } = require('perf_hooks');
335
+ *
336
+ * const obs = new PerformanceObserver((perfObserverList, observer) => {
337
+ * console.log(perfObserverList.getEntriesByName('meow'));
338
+ *
339
+ * * [
340
+ * * PerformanceEntry {
341
+ * * name: 'meow',
342
+ * * entryType: 'mark',
343
+ * * startTime: 98.545991,
344
+ * * duration: 0
345
+ * * }
346
+ * * ]
347
+ *
348
+ * console.log(perfObserverList.getEntriesByName('nope')); // []
349
+ *
350
+ * console.log(perfObserverList.getEntriesByName('test', 'mark'));
351
+ *
352
+ * * [
353
+ * * PerformanceEntry {
354
+ * * name: 'test',
355
+ * * entryType: 'mark',
356
+ * * startTime: 63.518931,
357
+ * * duration: 0
358
+ * * }
359
+ * * ]
360
+ *
361
+ * console.log(perfObserverList.getEntriesByName('test', 'measure')); // []
362
+ *
363
+ * performance.clearMarks();
364
+ * performance.clearMeasures();
365
+ * observer.disconnect();
366
+ * });
367
+ * obs.observe({ entryTypes: ['mark', 'measure'] });
368
+ *
369
+ * performance.mark('test');
370
+ * performance.mark('meow');
371
+ * ```
372
+ * @since v8.5.0
373
+ */
374
+ getEntriesByName(name: string, type?: EntryType): PerformanceEntry[];
375
+ /**
376
+ * Returns a list of `PerformanceEntry` objects in chronological order
377
+ * with respect to `performanceEntry.startTime` whose `performanceEntry.entryType`is equal to `type`.
378
+ *
379
+ * ```js
380
+ * const {
381
+ * performance,
382
+ * PerformanceObserver
383
+ * } = require('perf_hooks');
384
+ *
385
+ * const obs = new PerformanceObserver((perfObserverList, observer) => {
386
+ * console.log(perfObserverList.getEntriesByType('mark'));
387
+ *
388
+ * * [
389
+ * * PerformanceEntry {
390
+ * * name: 'test',
391
+ * * entryType: 'mark',
392
+ * * startTime: 55.897834,
393
+ * * duration: 0
394
+ * * },
395
+ * * PerformanceEntry {
396
+ * * name: 'meow',
397
+ * * entryType: 'mark',
398
+ * * startTime: 56.350146,
399
+ * * duration: 0
400
+ * * }
401
+ * * ]
402
+ *
403
+ * performance.clearMarks();
404
+ * performance.clearMeasures();
405
+ * observer.disconnect();
406
+ * });
407
+ * obs.observe({ type: 'mark' });
408
+ *
409
+ * performance.mark('test');
410
+ * performance.mark('meow');
411
+ * ```
412
+ * @since v8.5.0
413
+ */
414
+ getEntriesByType(type: EntryType): PerformanceEntry[];
415
+ }
416
+ type PerformanceObserverCallback = (list: PerformanceObserverEntryList, observer: PerformanceObserver) => void;
417
+ class PerformanceObserver extends AsyncResource {
418
+ constructor(callback: PerformanceObserverCallback);
419
+ /**
420
+ * Disconnects the `PerformanceObserver` instance from all notifications.
421
+ * @since v8.5.0
422
+ */
423
+ disconnect(): void;
424
+ /**
425
+ * Subscribes the `PerformanceObserver` instance to notifications of new `PerformanceEntry` instances identified either by `options.entryTypes`or `options.type`:
426
+ *
427
+ * ```js
428
+ * const {
429
+ * performance,
430
+ * PerformanceObserver
431
+ * } = require('perf_hooks');
432
+ *
433
+ * const obs = new PerformanceObserver((list, observer) => {
434
+ * // Called once asynchronously. `list` contains three items.
435
+ * });
436
+ * obs.observe({ type: 'mark' });
437
+ *
438
+ * for (let n = 0; n < 3; n++)
439
+ * performance.mark(`test${n}`);
440
+ * ```
441
+ * @since v8.5.0
442
+ */
443
+ observe(
444
+ options:
445
+ | {
446
+ entryTypes: ReadonlyArray<EntryType>;
447
+ buffered?: boolean | undefined;
448
+ }
449
+ | {
450
+ type: EntryType;
451
+ buffered?: boolean | undefined;
452
+ }
453
+ ): void;
454
+ }
455
+ namespace constants {
456
+ const NODE_PERFORMANCE_GC_MAJOR: number;
457
+ const NODE_PERFORMANCE_GC_MINOR: number;
458
+ const NODE_PERFORMANCE_GC_INCREMENTAL: number;
459
+ const NODE_PERFORMANCE_GC_WEAKCB: number;
460
+ const NODE_PERFORMANCE_GC_FLAGS_NO: number;
461
+ const NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED: number;
462
+ const NODE_PERFORMANCE_GC_FLAGS_FORCED: number;
463
+ const NODE_PERFORMANCE_GC_FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING: number;
464
+ const NODE_PERFORMANCE_GC_FLAGS_ALL_AVAILABLE_GARBAGE: number;
465
+ const NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY: number;
466
+ const NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE: number;
467
+ }
468
+ const performance: Performance;
469
+ interface EventLoopMonitorOptions {
470
+ /**
471
+ * The sampling rate in milliseconds.
472
+ * Must be greater than zero.
473
+ * @default 10
474
+ */
475
+ resolution?: number | undefined;
476
+ }
477
+ interface Histogram {
478
+ /**
479
+ * Returns a `Map` object detailing the accumulated percentile distribution.
480
+ * @since v11.10.0
481
+ */
482
+ readonly percentiles: Map<number, number>;
483
+ /**
484
+ * The number of times the event loop delay exceeded the maximum 1 hour event
485
+ * loop delay threshold.
486
+ * @since v11.10.0
487
+ */
488
+ readonly exceeds: number;
489
+ /**
490
+ * The minimum recorded event loop delay.
491
+ * @since v11.10.0
492
+ */
493
+ readonly min: number;
494
+ /**
495
+ * The maximum recorded event loop delay.
496
+ * @since v11.10.0
497
+ */
498
+ readonly max: number;
499
+ /**
500
+ * The mean of the recorded event loop delays.
501
+ * @since v11.10.0
502
+ */
503
+ readonly mean: number;
504
+ /**
505
+ * The standard deviation of the recorded event loop delays.
506
+ * @since v11.10.0
507
+ */
508
+ readonly stddev: number;
509
+ /**
510
+ * Resets the collected histogram data.
511
+ * @since v11.10.0
512
+ */
513
+ reset(): void;
514
+ /**
515
+ * Returns the value at the given percentile.
516
+ * @since v11.10.0
517
+ * @param percentile A percentile value in the range (0, 100].
518
+ */
519
+ percentile(percentile: number): number;
520
+ }
521
+ interface IntervalHistogram extends Histogram {
522
+ /**
523
+ * Enables the update interval timer. Returns `true` if the timer was
524
+ * started, `false` if it was already started.
525
+ * @since v11.10.0
526
+ */
527
+ enable(): boolean;
528
+ /**
529
+ * Disables the update interval timer. Returns `true` if the timer was
530
+ * stopped, `false` if it was already stopped.
531
+ * @since v11.10.0
532
+ */
533
+ disable(): boolean;
534
+ }
535
+ interface RecordableHistogram extends Histogram {
536
+ /**
537
+ * @since v15.9.0, v14.18.0
538
+ * @param val The amount to record in the histogram.
539
+ */
540
+ record(val: number | bigint): void;
541
+ /**
542
+ * Calculates the amount of time (in nanoseconds) that has passed since the
543
+ * previous call to `recordDelta()` and records that amount in the histogram.
544
+ *
545
+ * ## Examples
546
+ * @since v15.9.0, v14.18.0
547
+ */
548
+ recordDelta(): void;
549
+ /**
550
+ * Adds the values from other to this histogram.
551
+ * @since v17.4.0, v16.14.0
552
+ * @param other Recordable Histogram to combine with
553
+ */
554
+ add(other: RecordableHistogram): void;
555
+ }
556
+ /**
557
+ * _This property is an extension by Node.js. It is not available in Web browsers._
558
+ *
559
+ * Creates an `IntervalHistogram` object that samples and reports the event loop
560
+ * delay over time. The delays will be reported in nanoseconds.
561
+ *
562
+ * Using a timer to detect approximate event loop delay works because the
563
+ * execution of timers is tied specifically to the lifecycle of the libuv
564
+ * event loop. That is, a delay in the loop will cause a delay in the execution
565
+ * of the timer, and those delays are specifically what this API is intended to
566
+ * detect.
567
+ *
568
+ * ```js
569
+ * const { monitorEventLoopDelay } = require('perf_hooks');
570
+ * const h = monitorEventLoopDelay({ resolution: 20 });
571
+ * h.enable();
572
+ * // Do something.
573
+ * h.disable();
574
+ * console.log(h.min);
575
+ * console.log(h.max);
576
+ * console.log(h.mean);
577
+ * console.log(h.stddev);
578
+ * console.log(h.percentiles);
579
+ * console.log(h.percentile(50));
580
+ * console.log(h.percentile(99));
581
+ * ```
582
+ * @since v11.10.0
583
+ */
584
+ function monitorEventLoopDelay(options?: EventLoopMonitorOptions): IntervalHistogram;
585
+ interface CreateHistogramOptions {
586
+ /**
587
+ * The minimum recordable value. Must be an integer value greater than 0.
588
+ * @default 1
589
+ */
590
+ min?: number | bigint | undefined;
591
+ /**
592
+ * The maximum recordable value. Must be an integer value greater than min.
593
+ * @default Number.MAX_SAFE_INTEGER
594
+ */
595
+ max?: number | bigint | undefined;
596
+ /**
597
+ * The number of accuracy digits. Must be a number between 1 and 5.
598
+ * @default 3
599
+ */
600
+ figures?: number | undefined;
601
+ }
602
+ /**
603
+ * Returns a `RecordableHistogram`.
604
+ * @since v15.9.0, v14.18.0
605
+ */
606
+ function createHistogram(options?: CreateHistogramOptions): RecordableHistogram;
607
+
608
+ import { performance as _performance } from 'perf_hooks';
609
+ global {
610
+ /**
611
+ * `performance` is a global reference for `require('perf_hooks').performance`
612
+ * https://nodejs.org/api/globals.html#performance
613
+ * @since v16.0.0
614
+ */
615
+ var performance: typeof globalThis extends {
616
+ onmessage: any;
617
+ performance: infer T;
618
+ }
619
+ ? T
620
+ : typeof _performance;
621
+ }
622
+ }
623
+ declare module 'node:perf_hooks' {
624
+ export * from 'perf_hooks';
625
+ }