performance.mark(name[, options])


  • name <string>
  • options <Object>
    • detail <any> 可选的额外细节,可与标记一起包含。
    • startTime <number> 可选的时间戳,用作标记时间。 默认performance.now()

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

【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.】

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

【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.】