performance.measure(name[, startMarkOrOptions[, endMark]])
-
name<string> -
startMarkOrOptions<string> | <Object> 可选的。¥
startMarkOrOptions<string> | <Object> Optional.-
detail<any> 要包含在度量中的其他可选细节。¥
detail<any> Additional optional detail to include with the measure. -
duration<number> 开始和结束时间之间的持续时间。¥
duration<number> Duration between start and end times. -
end<number> | <string> 用作结束时间的时间戳,或标识先前记录标记的字符串。¥
end<number> | <string> Timestamp to be used as the end time, or a string identifying a previously recorded mark. -
start<number> | <string> 用作开始时间的时间戳,或标识先前记录标记的字符串。¥
start<number> | <string> Timestamp to be used as the start time, or a string identifying a previously recorded mark.
-
-
endMark<string> 可选的。如果startMarkOrOptions是 <Object>,则必须省略。¥
endMark<string> Optional. Must be omitted ifstartMarkOrOptionsis an <Object>.
在性能时间轴中创建新的 PerformanceMeasure 条目。PerformanceMeasure 是 PerformanceEntry 的子类,其 performanceEntry.entryType 始终为 'measure',其 performanceEntry.duration 测量自 startMark 和 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.
startMark 参数可以标识性能时间线中任何现有的 PerformanceMark,或者可以标识 PerformanceNodeTiming 类提供的任何时间戳属性。如果指定的 startMark 不存在,则抛出错误。
¥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, an error is thrown.
可选的 endMark 参数必须标识性能时间线中的任何现有 PerformanceMark 或 PerformanceNodeTiming 类提供的任何时间戳属性。不传入参数则 endMark 为 performance.now(),否则如果命名的 endMark 不存在,则抛出错误。
¥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.
创建的 PerformanceMeasure 条目放入全局的性能时间轴,可以用 performance.getEntries、performance.getEntriesByName、performance.getEntriesByType 查询。当执行观察时,应使用 performance.clearMeasures 手动从全局的性能时间轴中清除条目。
¥The created PerformanceMeasure entry is put in the global Performance Timeline
and can be queried with performance.getEntries,
performance.getEntriesByName, and performance.getEntriesByType. When the
observation is performed, the entries should be cleared from the global
Performance Timeline manually with performance.clearMeasures.