@@ -17,9 +17,12 @@ const obs = new PerformanceObserver((items) => {
17
17
performance .clearMarks ();
18
18
});
19
19
obs .observe ({ entryTypes: [' measure' ] });
20
+ performance .measure (' Start to Now' );
20
21
21
22
performance .mark (' A' );
22
23
doSomeLongRunningProcess (() => {
24
+ performance .measure (' A to Now' , ' A' );
25
+
23
26
performance .mark (' B' );
24
27
performance .measure (' A to B' , ' A' , ' B' );
25
28
});
@@ -53,14 +56,18 @@ Creates a new `PerformanceMark` entry in the Performance Timeline. A
53
56
` performanceEntry.duration ` is always ` 0 ` . Performance marks are used
54
57
to mark specific significant moments in the Performance Timeline.
55
58
56
- ### ` performance.measure(name, startMark, endMark) `
59
+ ### ` performance.measure(name[ , startMark[ , endMark]] ) `
57
60
<!-- YAML
58
61
added: v8.5.0
62
+ changes:
63
+ - version: REPLACEME
64
+ pr-url: https://github.com/nodejs/node/pull/32651
65
+ description: Make `startMark` and `endMark` parameters optional.
59
66
-->
60
67
61
68
* ` name ` {string}
62
- * ` startMark ` {string}
63
- * ` endMark ` {string}
69
+ * ` startMark ` {string} Optional.
70
+ * ` endMark ` {string} Optional.
64
71
65
72
Creates a new ` PerformanceMeasure ` entry in the Performance Timeline. A
66
73
` PerformanceMeasure ` is a subclass of ` PerformanceEntry ` whose
@@ -73,9 +80,10 @@ Performance Timeline, or *may* identify any of the timestamp properties
73
80
provided by the ` PerformanceNodeTiming ` class. If the named ` startMark ` does
74
81
not exist, then ` startMark ` is set to [ ` timeOrigin ` ] [ ] by default.
75
82
76
- The ` endMark ` argument must identify any * existing* ` PerformanceMark ` in the
77
- Performance Timeline or any of the timestamp properties provided by the
78
- ` PerformanceNodeTiming ` class. If the named ` endMark ` does not exist, an
83
+ The optional ` endMark ` argument must identify any * existing* ` PerformanceMark `
84
+ in the Performance Timeline or any of the timestamp properties provided by the
85
+ ` PerformanceNodeTiming ` class. ` endMark ` will be ` performance.now() `
86
+ if no parameter is passed, otherwise if the named ` endMark ` does not exist, an
79
87
error will be thrown.
80
88
81
89
### ` performance.nodeTiming `
0 commit comments