@@ -15,6 +15,7 @@ Node.js supports the following [Web Performance APIs][]:
1515* [ High Resolution Time] [ ]
1616* [ Performance Timeline] [ ]
1717* [ User Timing] [ ]
18+ * [ Resource Timing] [ ]
1819
1920``` js
2021const { PerformanceObserver , performance } = require (' node:perf_hooks' );
@@ -66,6 +67,17 @@ added: v16.7.0
6667If ` name ` is not provided, removes all ` PerformanceMeasure ` objects from the
6768Performance Timeline. If ` name ` is provided, removes only the named mark.
6869
70+ ### ` performance.clearResourceTimings([name]) `
71+
72+ <!-- YAML
73+ added: REPLACEME
74+ -->
75+
76+ * ` name ` {string}
77+
78+ If ` name ` is not provided, removes all ` PerformanceResourceTiming ` objects from
79+ the Resource Timeline. If ` name ` is provided, removes only the named resource.
80+
6981### ` performance.eventLoopUtilization([utilization1[, utilization2]]) `
7082
7183<!-- YAML
@@ -198,6 +210,33 @@ and can be queried with `performance.getEntries`,
198210observation is performed, the entries should be cleared from the global
199211Performance Timeline manually with ` performance.clearMarks ` .
200212
213+ ### \` performance.markResourceTiming(timingInfo, requestedUrl, initiatorType,
214+
215+ global, cacheMode)\`
216+
217+ <!-- YAML
218+ added: REPLACEME
219+ -->
220+
221+ * ` timingInfo ` {Object} [ Fetch Timing Info] [ ]
222+ * ` requestedUrl ` {string} The resource url
223+ * ` initiatorType ` {string} The initiator name, e.g: 'fetch'
224+ * ` global ` {Object}
225+ * ` cacheMode ` {string} The cache mode must be an empty string ('') or 'local'
226+
227+ _ This property is an extension by Node.js. It is not available in Web browsers._
228+
229+ Creates a new ` PerformanceResourceTiming ` entry in the Resource Timeline. A
230+ ` PerformanceResourceTiming ` is a subclass of ` PerformanceEntry ` whose
231+ ` performanceEntry.entryType ` is always ` 'resource' ` . Performance resources
232+ are used to mark moments in the Resource Timeline.
233+
234+ The created ` PerformanceMark ` entry is put in the global Resource Timeline
235+ and can be queried with ` performance.getEntries ` ,
236+ ` performance.getEntriesByName ` , and ` performance.getEntriesByType ` . When the
237+ observation is performed, the entries should be cleared from the global
238+ Performance Timeline manually with ` performance.clearResourceTimings ` .
239+
201240### ` performance.measure(name[, startMarkOrOptions[, endMark]]) `
202241
203242<!-- YAML
@@ -653,6 +692,188 @@ added: v8.5.0
653692The high resolution millisecond timestamp at which the V8 platform was
654693initialized.
655694
695+ ## Class: ` PerformanceResourceTiming `
696+
697+ <!-- YAML
698+ added: REPLACEME
699+ -->
700+
701+ * Extends: {PerformanceEntry}
702+
703+ Provides detailed network timing data regarding the loading of an application's
704+ resources.
705+
706+ The constructor of this class is not exposed to users directly.
707+
708+ ### ` performanceResourceTiming.workerStart `
709+
710+ <!-- YAML
711+ added: REPLACEME
712+ -->
713+
714+ * {number}
715+
716+ The high resolution millisecond timestamp at immediately before dispatching
717+ the ` fetch ` request. If the resource is not intercepted by a worker the property
718+ will always return 0.
719+
720+ ### ` performanceResourceTiming.redirectStart `
721+
722+ <!-- YAML
723+ added: REPLACEME
724+ -->
725+
726+ * {number}
727+
728+ The high resolution millisecond timestamp that represents the start time
729+ of the fetch which initiates the redirect.
730+
731+ ### ` performanceResourceTiming.redirectEnd `
732+
733+ <!-- YAML
734+ added: REPLACEME
735+ -->
736+
737+ * {number}
738+
739+ The high resolution millisecond timestamp that will be created immediately after
740+ receiving the last byte of the response of the last redirect.
741+
742+ ### ` performanceResourceTiming.fetchStart `
743+
744+ <!-- YAML
745+ added: REPLACEME
746+ -->
747+
748+ * {number}
749+
750+ The high resolution millisecond timestamp immediately before the Node.js starts
751+ to fetch the resource.
752+
753+ ### ` performanceResourceTiming.domainLookupStart `
754+
755+ <!-- YAML
756+ added: REPLACEME
757+ -->
758+
759+ * {number}
760+
761+ The high resolution millisecond timestamp immediately before the Node.js starts
762+ the domain name lookup for the resource.
763+
764+ ### ` performanceResourceTiming.domainLookupEnd `
765+
766+ <!-- YAML
767+ added: REPLACEME
768+ -->
769+
770+ * {number}
771+
772+ The high resolution millisecond timestamp representing the time immediately
773+ after the Node.js finished the domain name lookup for the resource.
774+
775+ ### ` performanceResourceTiming.connectStart `
776+
777+ <!-- YAML
778+ added: REPLACEME
779+ -->
780+
781+ * {number}
782+
783+ The high resolution millisecond timestamp representing the time immediately
784+ before Node.js starts to establish the connection to the server to retrieve
785+ the resource.
786+
787+ ### ` performanceResourceTiming.connectEnd `
788+
789+ <!-- YAML
790+ added: REPLACEME
791+ -->
792+
793+ * {number}
794+
795+ The high resolution millisecond timestamp representing the time immediately
796+ after Node.js finishes establishing the connection to the server to retrieve
797+ the resource.
798+
799+ ### ` performanceResourceTiming.secureConnectionStart `
800+
801+ <!-- YAML
802+ added: REPLACEME
803+ -->
804+
805+ * {number}
806+
807+ The high resolution millisecond timestamp representing the time immediately
808+ before Node.js starts the handshake process to secure the current connection.
809+
810+ ### ` performanceResourceTiming.requestStart `
811+
812+ <!-- YAML
813+ added: REPLACEME
814+ -->
815+
816+ * {number}
817+
818+ The high resolution millisecond timestamp representing the time immediately
819+ before Node.js receives the first byte of the response from the server.
820+
821+ ### ` performanceResourceTiming.responseEnd `
822+
823+ <!-- YAML
824+ added: REPLACEME
825+ -->
826+
827+ * {number}
828+
829+ The high resolution millisecond timestamp representing the time immediately
830+ after Node.js receives the last byte of the resource or immediately before
831+ the transport connection is closed, whichever comes first.
832+
833+ ### ` performanceResourceTiming.transferSize `
834+
835+ <!-- YAML
836+ added: REPLACEME
837+ -->
838+
839+ * {number}
840+
841+ A number representing the size (in octets) of the fetched resource. The size
842+ includes the response header fields plus the response payload body.
843+
844+ ### ` performanceResourceTiming.encodedBodySize `
845+
846+ <!-- YAML
847+ added: REPLACEME
848+ -->
849+
850+ * {number}
851+
852+ A number representing the size (in octets) received from the fetch
853+ (HTTP or cache), of the payload body, before removing any applied
854+ content-codings.
855+
856+ ### ` performanceResourceTiming.decodedBodySize `
857+
858+ <!-- YAML
859+ added: REPLACEME
860+ -->
861+
862+ * {number}
863+
864+ A number representing the size (in octets) received from the fetch
865+ (HTTP or cache), of the message body, after removing any applied
866+ content-codings.
867+
868+ ### ` performanceResourceTiming.toJSON() `
869+
870+ <!-- YAML
871+ added: REPLACEME
872+ -->
873+
874+ Returns a ` object ` that is the JSON representation of the
875+ ` PerformanceResourceTiming ` object
876+
656877## Class: ` perf_hooks.PerformanceObserver `
657878
658879### ` new PerformanceObserver(callback) `
@@ -1337,8 +1558,10 @@ dns.promises.resolve('localhost');
13371558```
13381559
13391560[ Async Hooks ] : async_hooks.md
1561+ [ Fetch Timing Info ] : https://fetch.spec.whatwg.org/#fetch-timing-info
13401562[ High Resolution Time ] : https://www.w3.org/TR/hr-time-2
13411563[ Performance Timeline ] : https://w3c.github.io/performance-timeline/
1564+ [ Resource Timing ] : https://www.w3.org/TR/resource-timing-2/
13421565[ User Timing ] : https://www.w3.org/TR/user-timing/
13431566[ Web Performance APIs ] : https://w3c.github.io/perf-timing-primer/
13441567[ Worker threads ] : worker_threads.md#worker-threads
0 commit comments