Performance: clearMeasures() method
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2015.
Note: This feature is available in Web Workers.
The clearMeasures()
method removes all or specific PerformanceMeasure
objects from the browser's performance timeline.
Syntax
js
clearMeasures()
clearMeasures(name)
Parameters
name
Optional-
A string representing the
name
of thePerformanceMeasure
object. If this argument is omitted, all entries with anentryType
of"measure"
will be removed.
Return value
None (undefined
).
Examples
Removing measures
To clean up all performance measure, or just specific entries, use the clearMeasures()
method like this:
js
// Create a bunch of measures
performance.measure("from navigation");
performance.mark("a");
performance.measure("from mark a", "a");
performance.measure("from navigation");
performance.measure("from mark a", "a");
performance.mark("b");
performance.measure("between a and b", "a", "b");
performance.getEntriesByType("measure").length; // 5
// Delete just the "from navigation" measure entries
performance.clearMeasures("from navigation");
performance.getEntriesByType("measure").length; // 3
// Delete all of the measure entries
performance.clearMeasures();
performance.getEntriesByType("measure").length; // 0
Specifications
Specification |
---|
User Timing # dom-performance-clearmeasures |
Browser compatibility
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
clearMeasures |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- Requires a vendor prefix or different name for use.
- Has more compatibility info.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.