performance.measure(name[, startMark[, endMark]])


在性能时间轴中创建新的 PerformanceMeasure 条目。 PerformanceMeasurePerformanceEntry 的子类,其 performanceEntry.entryType 始终为 'measure',其 performanceEntry.duration 测量自 startMarkendMark 以来经过的毫秒数。

startMark 参数可以标识性能时间轴中的任何现有的 PerformanceMark,或者可能标识由 PerformanceNodeTiming 类提供的任何时间戳属性。 如果命名的 startMark 不存在,则默认情况下将 startMark 设置为 timeOrigin

可选的 endMark 参数必须标识性能时间轴中的任何现有的 PerformanceMarkPerformanceNodeTiming 类提供的任何时间戳属性。 不传入参数则 endMarkperformance.now(),否则如果命名的 endMark 不存在,则抛出错误。

Creates a new PerformanceMeasure entry in the Performance Timeline. A PerformanceMeasure is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'measure', and whose performanceEntry.duration measures the number of milliseconds elapsed since startMark and endMark.

The startMark argument may identify any existing PerformanceMark in the Performance Timeline, or may identify any of the timestamp properties provided by the PerformanceNodeTiming class. If the named startMark does not exist, then startMark is set to timeOrigin by default.

The optional endMark argument must identify any existing PerformanceMark in the Performance Timeline or any of the timestamp properties provided by the PerformanceNodeTiming class. endMark will be performance.now() if no parameter is passed, otherwise if the named endMark does not exist, an error will be thrown.