The mark() method creates a timestamp in the browser's performance entry buffer with the given name. The application defined timestamp can be retrieved by one of the Performance interface's getEntries*() methods (getEntries(), getEntriesByName() or getEntriesByType()).
The mark's performance entry will have the following property values:
entryType - set to "mark".name - set to the "name" given when the mark was created.startTime - set to the timestamp when mark() was called.duration - set to "0" (a mark has no duration).If the name given to this method already exists in the PerformanceTiming interface, SyntaxError is thrown.
performance.mark(name);
DOMString representing the name of the mark.The following example shows how mark() is used to create an application-defined peformance entry in the browser's performance entry buffer.
function create_mark(name) {
if (performance.mark === undefined) {
console.log("performance.mark Not supported");
return;
}
// Create the performance mark
performance.mark(name);
}
| Specification | Status | Comment |
|---|---|---|
| User Timing Level 2 The definition of 'mark()' in that specification. | Working Draft | Clarifies mark() processing model. |
| User Timing The definition of 'mark()' in that specification. | Recommendation | Basic definition. |
| Desktop | ||||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
| Basic support | 43 | Yes | 41 | 10 | 33 | 11 |
| Mobile | |||||||
|---|---|---|---|---|---|---|---|
| Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
| Basic support | 46 | 46 | Yes | 42 | 33 | 11 | ? |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Performance/mark