性能
interface provides access to performance-related information for the current page. It's part of the High Resolution Time API, but is enhanced by the
性能时间线 API
,
导航计时 API
,
用户计时 API
,和
资源计时 API
.
An object of this type can be obtained by calling the
window.performance
read-only attribute.
注意 : This interface and its members are available in Web 工作者 , except where indicated below. Also, note that performance markers and measures are per context. If you create a mark on the main thread (or other worker), you cannot see it in a worker thread, and vice versa.
性能
interface doesn't inherit any properties.
Performance.navigation
只读
PerformanceNavigation
object that provides useful context about the operations included in the times listed in
timing
, including whether the page was a load or a refresh, how many redirections occurred, and so forth. Not available in workers.
Performance.timing
只读
PerformanceTiming
object containing latency-related performance information. Not available in workers.
Performance.memory
只读
Performance.timeOrigin
只读
Returns the high resolution timestamp of the start time of the performance measurement.
性能
interface doesn't inherit any
方法
.
Performance.clearMarks()
Performance.clearMeasures()
Performance.clearResourceTimings()
performance entries
采用
entryType
of "
resource
" from the browser's performance data buffer.
Performance.getEntries()
PerformanceEntry
objects based on the given
filter
.
Performance.getEntriesByName()
PerformanceEntry
objects based on the given
name
and
entry type
.
Performance.getEntriesByType()
PerformanceEntry
objects of the given
entry type
.
Performance.mark()
timestamp
in the browser's
performance entry buffer
with the given name.
Performance.measure()
timestamp
in the browser's performance entry buffer between two specified marks (known as the
start mark
and
end mark
, respectively).
Performance.now()
DOMHighResTimeStamp
representing the number of milliseconds elapsed since a reference instant.
Performance.setResourceTimingBufferSize()
resource
"
type
performance entry
对象。
Performance.toJSON()
性能
对象。
监听这些事件使用
addEventListener()
或通过把事件监听器赋值给
on
eventname
特性为此接口。
resourcetimingbufferfull
onresourcetimingbufferfull
特性。
| 规范 | 状态 | 注释 |
|---|---|---|
|
High Resolution Time Level 2
The definition of 'Performance' in that specification. |
推荐 |
定义
toJson()
方法。
|
|
高分辨率时间
The definition of 'Performance' in that specification. |
推荐 |
定义
now()
方法。
|
|
Performance Timeline Level 2
The definition of 'Performance extensions' in that specification. |
候选推荐 |
变化
getEntries()
接口。
|
|
性能时间线
The definition of 'Performance extensions' in that specification. |
推荐 |
定义
getEntries()
,
getEntriesByType()
and
getEntriesByName()
方法。
|
|
Resource Timing Level 1
The definition of 'Performance extensions' in that specification. |
候选推荐 |
定义
clearResourceTimings()
and
setResourceTimingBufferSize()
methods and the
onresourcetimingbufferfull
特性。
|
|
User Timing Level 2
The definition of 'Performance extensions' in that specification. |
工作草案 |
Clarifies
mark()
,
clearMark()
,
measure()
and
clearMeasure()
方法。
|
|
User Timing
The definition of 'Performance extensions' in that specification. |
推荐 |
定义
mark()
,
clearMark()
,
measure()
and
clearMeasure()
方法。
|
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
性能
|
Chrome 6 | Edge 12 | Firefox 7 | IE 9 | Opera 15 | Safari 8 | WebView Android 1 | Chrome Android 18 | Firefox Android 7 | Opera Android 14 | Safari iOS 9 | Samsung Internet Android 1.0 |
clearMarks
|
Chrome
29
|
Edge 12 | Firefox 41 | IE 10 | Opera 33 | Safari 11 |
WebView Android
≤37
|
Chrome Android
29
|
Firefox Android 42 | Opera Android 33 | Safari iOS 11 |
Samsung Internet Android
2.0
|
clearMeasures
|
Chrome
29
|
Edge 12 | Firefox 41 | IE 10 | Opera 33 | Safari 11 | WebView Android Yes |
Chrome Android
29
|
Firefox Android 42 | Opera Android 33 | Safari iOS 11 |
Samsung Internet Android
2.0
|
clearResourceTimings
|
Chrome
46
|
Edge 12 | Firefox Yes | IE Yes | Opera Yes | Safari 11 |
WebView Android
46
|
Chrome Android
46
|
Firefox Android Yes | Opera Android Yes | Safari iOS 11 |
Samsung Internet Android
5.0
|
getEntries
|
Chrome
28
|
Edge 12 | Firefox Yes | IE Yes | Opera 不支持 No | Safari 11 | WebView Android Yes |
Chrome Android
28
|
Firefox Android 25 | Opera Android 不支持 No | Safari iOS 11 |
Samsung Internet Android
1.5
|
getEntriesByName
|
Chrome
28
|
Edge 12 | Firefox Yes | IE Yes | Opera 不支持 No | Safari 11 | WebView Android Yes |
Chrome Android
28
|
Firefox Android 25 | Opera Android 不支持 No | Safari iOS 11 |
Samsung Internet Android
1.5
|
getEntriesByType
|
Chrome
28
|
Edge 12 | Firefox Yes | IE Yes |
Opera
15
|
Safari 11 | WebView Android Yes |
Chrome Android
28
|
Firefox Android 25 |
Opera Android
15
|
Safari iOS 11 |
Samsung Internet Android
1.5
|
mark
|
Chrome
28
|
Edge 12 | Firefox 41 | IE 10 | Opera 33 | Safari 11 | WebView Android Yes |
Chrome Android
28
|
Firefox Android 42 | Opera Android 33 | Safari iOS 11 | Samsung Internet Android 1.5 |
measure
|
Chrome
28
|
Edge 12 | Firefox 41 | IE 10 | Opera 33 | Safari 11 | WebView Android 46 |
Chrome Android
28
|
Firefox Android 42 | Opera Android 33 | Safari iOS 11 | Samsung Internet Android 1.5 |
memory
非标
|
Chrome 7 | Edge ≤79 | Firefox 不支持 No | IE ? | Opera Yes | Safari 不支持 No | WebView Android Yes | Chrome Android 18 | Firefox Android 不支持 No | Opera Android Yes | Safari iOS 不支持 No | Samsung Internet Android 1.0 |
navigation
弃用
|
Chrome 10 | Edge 12 | Firefox 7 | IE 9 | Opera 15 | Safari 8 | WebView Android Yes | Chrome Android 18 | Firefox Android 7 | Opera Android 不支持 No | Safari iOS 9 | Samsung Internet Android 1.0 |
now
|
Chrome
24
|
Edge 12 |
Firefox
15
注意事项
|
IE 10 | Opera 15 | Safari 8 | WebView Android Yes | Chrome Android 25 |
Firefox Android
15
注意事项
|
Opera Android 14 | Safari iOS 9 | Samsung Internet Android 1.5 |
onresourcetimingbufferfull
|
Chrome
46
|
Edge ≤79 | Firefox Yes | IE 不支持 No | Opera 不支持 No | Safari 11 |
WebView Android
46
|
Chrome Android
46
|
Firefox Android Yes | Opera Android Yes | Safari iOS 不支持 No |
Samsung Internet Android
5.0
|
resourcetimingbufferfull
event
|
Chrome
46
|
Edge ≤79 | Firefox Yes | IE 不支持 No | Opera 不支持 No | Safari 11 |
WebView Android
46
|
Chrome Android
46
|
Firefox Android Yes | Opera Android Yes | Safari iOS 不支持 No |
Samsung Internet Android
5.0
|
setResourceTimingBufferSize
|
Chrome
46
|
Edge 12 | Firefox Yes | IE Yes | Opera Yes | Safari 11 |
WebView Android
46
|
Chrome Android
46
|
Firefox Android Yes | Opera Android Yes | Safari iOS 不支持 No |
Samsung Internet Android
5.0
|
timeOrigin
|
Chrome 62 | Edge 16 | Firefox 53 | IE ? | Opera 49 | Safari 不支持 No | WebView Android 62 | Chrome Android 62 | Firefox Android 53 | Opera Android 46 | Safari iOS 不支持 No | Samsung Internet Android 8.0 |
timing
弃用
|
Chrome 6 | Edge 12 | Firefox 7 | IE 9 | Opera 15 | Safari 8 | WebView Android Yes | Chrome Android 18 | Firefox Android 7 | Opera Android 14 | Safari iOS 9 | Samsung Internet Android 1.0 |
toJSON
|
Chrome 56 | Edge 12 | Firefox 25 | IE ? | Opera 不支持 No | Safari 不支持 No | WebView Android 56 | Chrome Android 56 | Firefox Android 25 | Opera Android 不支持 No | Safari iOS 不支持 No | Samsung Internet Android 6.0 |
完整支持
不支持
兼容性未知
实验。期望将来行为有所改变。
非标。预期跨浏览器支持较差。
弃用。不要用于新网站。
见实现注意事项。
使用非标名称。
要求使用供应商前缀或不同名称。