1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
---
title: Performance
slug: Web/API/Performance
tags:
- API
- Interface
- Navigation Timing
- NeedsTranslation
- Performance
- Reference
- TopicStub
- Web Performance
translation_of: Web/API/Performance
---
<div>{{APIRef("High Resolution Time")}}</div>
<p>The <strong><code>Performance</code></strong> interface represents timing-related performance information for the given page.</p>
<p>An object of this type can be obtained by calling the {{domxref("Window.performance")}} read-only attribute.</p>
<div class="note">
<p><strong><em>Note</em>: </strong>This interface and its members are available in <a href="/en-US/docs/Web/API/Web_Workers_API">Web Workers</a>, except where indicated below. Note that some available parts of the interface are not yet documented (see the <a href="http://www.w3.org/TR/performance-timeline/#sec-window.performance-attribute">Performance Timeline</a> and <a href="http://www.w3.org/TR/user-timing/#extensions-performance-interface">User Timing</a> specs for more details.) 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.</p>
</div>
<h2 id="Properties">Properties</h2>
<p><em>The <code>Performance</code> interface doesn't inherit any properties.</em></p>
<dl>
<dt>{{domxref("Performance.navigation")}} {{readonlyInline}}</dt>
<dd>Is a {{domxref("PerformanceNavigation")}} object representing the type of navigation that occurs in the given browsing context, like the amount of redirections needed to fetch the resource. Not available in workers.</dd>
<dt>{{domxref("Performance.onframetimingbufferfull")}}</dt>
<dd>TBD</dd>
<dt>{{domxref("Performance.onresourcetimingbufferfull")}}</dt>
<dd>Is an {{domxref("EventTarget")}} which is a callback that will be called when the {{event("resourcetimingbufferfull")}} event is fired.</dd>
<dt>{{domxref("Performance.timing")}} {{readonlyInline}}</dt>
<dd>Is a {{domxref("PerformanceTiming")}} object containing latency-related performance information. Not available in workers.</dd>
</dl>
<h2 id="Methods">Methods</h2>
<p><em><em>The <code>Performance</code> interface doesn't inherit any </em>method</em>.</p>
<dl>
<dt>{{domxref("Performance.clearFrameTimings()")}}</dt>
<dd>TBD</dd>
<dt>{{domxref("Performance.clearMarks()")}}</dt>
<dd>Removes the given <em>mark</em> from the browser's performance entry buffer.</dd>
<dt>{{domxref("Performance.clearMeasures()")}}</dt>
<dd>Removes the given <em>measure</em> from the browser's performance entry buffer.</dd>
<dt>{{domxref("Performance.clearResourceTimings()")}}</dt>
<dd>Removes all {{domxref("PerformanceEntry","performance entries")}} with a {{domxref("PerformanceEntry.entryType","entryType")}} of "<code>resource</code>" from the browser's performance data buffer.</dd>
<dt>{{domxref("Performance.getEntries()")}}</dt>
<dd>Returns a list of {{domxref("PerformanceEntry")}} objects based on the given <em>filter</em>.</dd>
<dt>{{domxref("Performance.getEntriesByName()")}}</dt>
<dd>Returns a list of {{domxref("PerformanceEntry")}} objects based on the given <em>name</em> and <em>entry type</em>.</dd>
<dt>{{domxref("Performance.getEntriesByType()")}}</dt>
<dd>Returns a list of {{domxref("PerformanceEntry")}} objects of the given <em>entry type</em>.</dd>
<dt>{{domxref("Performance.mark()")}}</dt>
<dd>Creates a {{domxref("DOMHighResTimeStamp","timestamp")}} in the browser's <em>performance entry buffer</em> with the given name.</dd>
<dt>{{domxref("Performance.measure()")}}</dt>
<dd>Creates a named {{domxref("DOMHighResTimeStamp","timestamp")}} in the browser's performance entry buffer between two specified marks (known as the <em>start mark</em> and <em>end mark</em>, respectively).</dd>
<dt>{{domxref("Performance.now()")}}</dt>
<dd>Returns a {{domxref("DOMHighResTimeStamp")}} representing the amount of milliseconds elapsed since a reference instant.</dd>
<dt>{{domxref("Performance.setFrameTimingBufferSize()")}}</dt>
<dd>TBD</dd>
<dt>{{domxref("Performance.setResourceTimingBufferSize()")}}</dt>
<dd>Sets the browser's resource timing buffer size to the specified number of "<code>resource</code>" {{domxref("PerformanceEntry.entryType","type")}} {{domxref("PerformanceEntry","performance entry")}} objects.</dd>
<dt>{{domxref("Performance.toJSON()")}}</dt>
<dd>Is a jsonizer returning a json object representing the <code>Performance</code> object.</dd>
</dl>
<h2 id="Specifications">Specifications</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
<tr>
<td>{{SpecName('Highres Time Level 2', '#the-performance-interface', 'toJSON()')}}</td>
<td>{{Spec2('Highres Time Level 2')}}</td>
<td>Defines <code>toJson()</code> method.</td>
</tr>
<tr>
<td>{{SpecName('Highres Time', '#the-performance-interface', 'Performance')}}</td>
<td>{{Spec2('Highres Time')}}</td>
<td>Defines <code>now()</code> method.</td>
</tr>
<tr>
<td>{{SpecName('Navigation Timing', '#sec-window.performance-attribute', 'Performance')}}</td>
<td>{{Spec2('Navigation Timing')}}</td>
<td>Defines <code>timing</code> and <code>navigation</code> properties.</td>
</tr>
<tr>
<td>{{SpecName('Performance Timeline Level 2', '#extensions-to-the-performance-interface', 'Performance extensions')}}</td>
<td>{{Spec2('Performance Timeline Level 2')}}</td>
<td>Changes <code>getEntries()</code> interface.</td>
</tr>
<tr>
<td>{{SpecName('Performance Timeline', '#sec-window.performance-attribute', 'Performance extensions')}}</td>
<td>{{Spec2('Performance Timeline')}}</td>
<td>Defines <code>getEntries()</code>, <code>getEntriesByType()</code> and <code>getEntriesByName()</code> methods.</td>
</tr>
<tr>
<td>{{SpecName('Resource Timing', '#extensions-performance-interface', 'Performance extensions')}}</td>
<td>{{Spec2('Resource Timing')}}</td>
<td>Defines <code>clearResourceTimings()</code> and <code>setResourceTimingBufferSize()</code> methods and the <code>onresourcetimingbufferfull</code> property.</td>
</tr>
<tr>
<td>{{SpecName('User Timing Level 2', '#extensions-performance-interface', 'Performance extensions')}}</td>
<td>{{Spec2('User Timing Level 2')}}</td>
<td>Clarifies <code>mark()</code>, <code>clearMark()</code>, <code>measure()</code> and <code>clearMeasure()</code> methods.</td>
</tr>
<tr>
<td>{{SpecName('User Timing', '#extensions-performance-interface', 'Performance extensions')}}</td>
<td>{{Spec2('User Timing')}}</td>
<td>Defines <code>mark()</code>, <code>clearMark()</code>, <code>measure()</code> and <code>clearMeasure()</code> methods.</td>
</tr>
<tr>
<td>{{SpecName('<span style="line-height: 1.5;">Frame Timing', '#extensions-performance-interface','Performance extensions')}}</span></td>
<td>{{Spec2('User Timing')}}</td>
<td>Defines <code>clearFrameTimings()</code>, <code>setFrameTimingBufferSize()</code>, and <code>onframetimingbufferfull</code> methods.</td>
</tr>
</tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<div>
<div>
<p>{{Compat("api.Performance")}}</p>
</div>
</div>
|