The PerformanceMark() constructor creates a timestamp with the given name.
Unlike performance.mark(), performance marks created by the constructor aren't added to the browser's performance timeline. This means that calls to the Performance interface's getEntries*() methods (getEntries(), getEntriesByName() or getEntriesByType()) won't show entries for these marks.
Syntax
new PerformanceMark(name)
new PerformanceMark(name, markOptions)
Parameters
-
name
-
A string representing the name of the mark.
markOptions Optional
-
An object for specifying a timestamp and additional metadata for the mark.
detail Optional
-
Arbitrary metadata to include in the mark. Defaults to null.
startTime Optional
-
DOMHighResTimeStamp to use as the mark time. Defaults to performance.now().
Return value
Exceptions
Examples
The following example shows how PerformanceMark entries are constructed and then aren't part of the browser's performance timeline.
new PerformanceMark("squirrel");
new PerformanceMark("monkey");
new PerformanceMark("dog");
const allEntries = performance.getEntriesByType("mark");
console.log(allEntries.length);
Specifications
Browser compatibility
|
Desktop |
Mobile |
|
Chrome |
Edge |
Firefox |
Internet Explorer |
Opera |
Safari |
WebView Android |
Chrome Android |
Firefox for Android |
Opera Android |
Safari on IOS |
Samsung Internet |
PerformanceMark |
76 |
79 |
101 |
No |
63 |
14.1 |
79 |
76 |
101 |
54 |
14.5 |
12.0 |
See also