This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

clearMeasures

Summary

Removes all DOMHighResTimeStamp durations for the given measure name, or removes all measures and their associated DOMHighResTimeStamp durations.

Method of apis/user_timing/Performanceapis/user_timing/Performance

Syntax

 object.clearMeasures(measureName);

Parameters

measureName

Data-type
any

(Optional)

Name of the measures(s) to be cleared.

Return Value

No return value

Examples

// set begin mark
performance.mark("startMark");
// execute a function to be measured
someFunction();
// set end mark
performance.mark("stopMark");

// save the timing information
performance.measure("functionTime", "startMark", "stopMark");
// display the measured time
var measures = performance.getEntriesByType("measure");
alert("functionTime: " + measures[0].duration);

// clear the measure "functionTime"
performance.clearMeasures("functionTime");
// clear all marks
performance.clearMarks();

Notes

If a value for the measureName parameter is specified, only measures with that name are removed. If there are no measures with the specified name, this method does nothing.

Related specifications

W3C User Timing Specification
W3C Recommendation

Attributions