performance.mark([name[, options]])


  • name <string>
  • options <Object>
    • detail <any> 包含在标记中的附加可选细节。
    • startTime <number> 用作标记时间的可选时间戳。 默认值: performance.now().

在性能时间轴中创建新的 PerformanceMark 条目。 PerformanceMarkPerformanceEntry 的子类,其 performanceEntry.entryType 始终为 'mark',而其 performanceEntry.duration 始终为 0。 性能标记用于标记性能时间轴中的特定重要时刻。

创建的 PerformanceMark 条目放入全局的性能时间轴,可以用 performance.getEntriesperformance.getEntriesByNameperformance.getEntriesByType 查询。 当执行观察时,应使用 performance.clearMarks 手动从全局的性能时间轴中清除条目。

  • name <string>
  • options <Object>
    • detail <any> Additional optional detail to include with the mark.
    • startTime <number> An optional timestamp to be used as the mark time. Default: performance.now().

Creates a new PerformanceMark entry in the Performance Timeline. A PerformanceMark is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'mark', and whose performanceEntry.duration is always 0. Performance marks are used to mark specific significant moments in the Performance Timeline.

The created PerformanceMark 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.clearMarks.