index.html
35.8 KB
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="content-type">
<title>User Timing</title>
<style type="text/css">
pre.idl { border:solid thin; background:#eee; color:#000; padding:0.5em }
pre.idl :link, pre.idl :visited { color:inherit; background:transparent }
pre code { color:inherit; background:transparent }
div.example { margin-left:1em; padding-left:1em; border-left:double; color:#222; background:#fcfcfc }
.note { margin-left:2em; font-weight:bold; font-style:italic; color:#008000 }
p.note::before { content:"Note: " }
.XXX { padding:.5em; border:solid #f00 }
p.XXX::before { content:"Issue: " }
dl.switch { padding-left:2em }
dl.switch > dt { text-indent:-1.5em }
dl.switch > dt:before { content:'\21AA'; padding:0 0.5em 0 0; display:inline-block; width:1em; text-align:right; line-height:0.5em }
dl.domintro { color: green; margin: 2em 0 2em 2em; padding: 0.5em 1em; border: none; background: #DDFFDD; }
dl.domintro dt, dl.domintro dt * { color: black; text-decoration: none; }
dl.domintro dd { margin: 0.5em 0 1em 2em; padding: 0; }
dl.domintro dd p { margin: 0.5em 0; }
dl.domintro:before { display: table; margin: -1em -0.5em -0.5em auto; width: auto; content: 'This box is non-normative. Implementation requirements are given below this box.'; color: red; border: solid 2px; background: white; padding: 0 0.25em; }
em.ct { text-transform:lowercase; font-variant:small-caps; font-style:normal }
dfn { font-weight:bold; font-style:normal }
code { color:orangered }
code :link, code :visited { color:inherit }
hr:not(.top) { display:block; background:none; border:none; padding:0; margin:2em 0; height:auto }
table { border-collapse:collapse; border-style:hidden hidden none hidden }
table thead { border-bottom:solid }
table tbody th:first-child { border-left:solid }
table td, table th { border-left:solid; border-right:solid; border-bottom:solid thin; vertical-align:top; padding:0.2em }
div.parameters { display:block; margin-left: 25px;}
div.parameterDefinition { display:block; margin-left: 25px;}
div.methods { display:block; margin-top:30px; margin-left :25px;}
</style>
<link href="http://www.w3.org/StyleSheets/TR/W3C-WD.css" rel="stylesheet" type="text/css">
</head>
<body class="wd">
<div class="head">
<p>
<a href="http://www.w3.org/"><img alt="W3C" src="http://www.w3.org/Icons/w3c_home" height="48" width="72"></a>
</p>
<h1>User Timing</h1>
<h2 class="no-num no-toc" id="working-draft-september-2011">W3C Working Draft 1 September 2011</h2>
<dl>
<dt>This version:</dt>
<dd><a href="http://www.w3.org/TR/2011/WD-user-timing-20110901/">http://www.w3.org/TR/2011/WD-user-timing-20110901/</a></dd>
<dt>Latest version:</dt>
<dd><a href="http://www.w3.org/TR/user-timing/">http://www.w3.org/TR/user-timing/</a></dd>
<dt>Latest Editor's Draft:</dt>
<dd><a href="https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/UserTiming/Overview.html">https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/UserTiming/Overview.html</a></dd>
<dt>Previous version:</dt>
<dd><a href="http://www.w3.org/TR/2011/WD-user-timing-20110811/">http://www.w3.org/TR/2011/WD-user-timing-20110811/</a></dd>
<dt>Editors:</dt>
<dd class="vcard">
<span class="fn">Jatinder Mann</span>, <span class="org">Microsoft Inc.</span>,
<span class="email">jmann@microsoft.com</span>
</dd>
<dd class="vcard">
<span class="fn">Zhiheng Wang</span>, <span class="org">Google Inc.</span>,
<span class="email">zhihengw@google.com</span>
</dd>
<dd class="vcard">
<span class="fn">Anderson Quach</span>,
<span class="org">Microsoft Inc. <i>(Until March 2011)</i></span>
</dd>
</dl>
<p class=copyright><a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a>
© 2011 <a href="http://www.w3.org/"><acronym title="World Wide Web
Consortium">W3C</acronym></a><sup>®</sup> (<a
href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute
of Technology">MIT</acronym></a>, <a
href="http://www.ercim.eu/"><acronym title="European Research Consortium
for Informatics and Mathematics">ERCIM</acronym></a>, <a
href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C <a
href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>
and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a>
rules apply.</p>
<hr class='top'>
</div>
<div class='body'>
<h2 class="no-num no-toc" id="abstract">Abstract</h2>
<p>This specification defines an interface to help web
developers measure the performance of their applications by giving them access
to high precision timestamps.</p>
<h2 class="no-num no-toc" id="status-of-this-document">Status of this document</h2>
<p><em>This section describes the status of this document at the time of
its publication. Other documents may supersede this document. A list of
current W3C publications and the latest revision of this technical report
can be found in the <a href="http://www.w3.org/TR/">W3C technical reports
index</a> at http://www.w3.org/TR/.</em></p>
<p>This is a <strong>Last Call</strong> Working Draft of "User Timing".</p>
<p>Please send comments
to <a href="mailto:public-web-perf@w3.org?subject=[UserTiming]%20">public-web-perf@w3.org</a>
(<a href="http://lists.w3.org/Archives/Public/public-web-perf/">archived</a>)
with <samp>[UserTiming]</samp> at the start of the subject line by <strong>22 September 2011</strong>.</p>
<p>A <a href='diff.html'>diff document</a> with the previous draft is available.</p>
<p>This document is produced by
the <a href="http://www.w3.org/2010/webperf/">Web Performance</a>
Working Group. The Web Performance Working Group is part of
the <a href="http://www.w3.org/2006/rwc/Activity">Rich Web Clients
Activity</a> in the
W3C <a href="http://www.w3.org/Interaction/">Interaction
Domain</a>.
<p>
<strong>You can find the latest <a href="http://www.w3c-test.org/webperf/specs/UserTiming/">Editor's Draft</a> of this document in the <a href="https://dvcs.w3.org/hg/webperf/">W3C's Mercurial repository</a>, which is updated on a regular basis.</strong>
</p>
<p>Publication as a Working Draft does not imply endorsement by the
W3C Membership. This is a draft document and may be updated, replaced
or obsoleted by other documents at any time. It is inappropriate to
cite this document as other than work in progress. </p>
<p>This document was produced by a group operating under
the <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5
February 2004 W3C Patent Policy</a>. W3C maintains
a <a href="http://www.w3.org/2004/01/pp-impl/45211/status"
rel="disclosure">public list of any patent disclosures</a> made in
connection with the deliverables of the group; that page also
includes instructions for disclosing a patent. An individual who
has actual knowledge of a patent which the individual believes
contains <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential
Claim(s)</a> must disclose the information in accordance
with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section
6 of the W3C Patent Policy</a>.</p>
<h2 class="no-num no-toc" id="table-of-contents">Table of Contents</h2>
<ol class="toc">
<li><a href="#introduction"><span class="secno">1
</span>Introduction</a></li>
<li><a href="#conformance-requirements"><span class="secno">2
</span>Conformance requirements</a></li>
<li><a href="#terminology"><span class="secno">3 </span>Terminology</a></li>
<li><a href="#user-timing-0"><span class="secno">4 </span>User Timing</a>
<ol class="toc">
<li><a href="#introduction-1"><span class="secno">4.1</span> Introduction</a></li>
<li><a href="#the-usertiming-interface"><span class="secno">4.2</span> The <code>UserTiming</code> Interface</a></li>
<li><a href="#the-performancemark-interface"><span class="secno">4.3</span> The <code>PerformanceMark</code> Interface</a></li>
<li><a href="#the-performancemeasure-interface"><span class="secno">4.4</span> The <code>PerformanceMeasure</code> Interface</a></li>
<li><a href="#vendor-prefixes"><span class="secno">4.5</span> Vendor Prefixes</a></li>
</ol>
</li>
<li><a href="#monotonic-clock"><span class="secno">5 </span>Monotonic Clock</a></li>
<li><a href="#privacy"><span class="secno">6 </span>Privacy</a></li>
<li><a href="#security"><span class="secno">7 </span>Security</a></li>
<li><a class="no-num" href="#acknowledgements">Acknowledgements</a></li>
</ol>
<h2 id="introduction"><span class="secno">1 </span>Introduction</h2>
<p>This section is non-normative.</p>
<p>Web developers need the ability to assess and understand the performance characteristics of their
applications. While JavaScript provides a mechanism to measure application latency (retrieving the current
timestamp from the <code>Date.now()</code> method), the precision of this timestamp varies between user agents.</p>
<p>This document introduces the <a href="#the-usertiming-interface">UserTiming</a> interface,
which exposes a high precision timestamp to developers so they can better measure the performance of their applications.</p>
<p class="issue"><strong>TODO:</strong> Show example usage.</p>
<h2 id="conformance-requirements"><span class="secno">2 </span>Conformance
requirements</h2>
<p>All diagrams, examples, and notes in this specification are non-normative,
as are all sections explicitly marked non-normative. Everything else in this
specification is normative. </p>
<p>The key words "MUST", "MUST NOT", "REQUIRED", "SHOULD", "SHOULD NOT",
"RECOMMENDED", "MAY", and "OPTIONAL" in the normative parts of this document
are to be interpreted as described in RFC2119. For readability, these words
do not appear in all uppercase letters in this specification. <a
href="#rfc2119">[RFC2119]</a>
</p>
<p>Requirements phrased in the imperative as part of algorithms (such as
"strip any leading space characters" or "return false and abort these steps")
are to be interpreted with the meaning of the key word ("must", "should",
"may", etc) used in introducing the algorithm. </p>
<p>Some conformance requirements are phrased as requirements on attributes,
methods or objects. Such requirements are to be interpreted as requirements
on user agents. </p>
<p>Conformance requirements phrased as algorithms or specific steps may be
implemented in any manner, so long as the end result is equivalent. (In
particular, the algorithms defined in this specification are intended to be
easy to follow, and not intended to be performant.) </p>
<p>The IDL fragments in this specification must be interpreted as
required for conforming IDL fragments, as described in the Web IDL
specification. <a href="#WebIDL">[Web IDL]</a></p>
<h2 id="terminology"><span class="secno">3 </span>Terminology</h2>
<p>The construction "a <code title="">Foo</code> object", where <code
title="">Foo</code> is actually an interface, is sometimes used instead of
the more accurate "an object implementing the interface <code
title="">Foo</code>". </p>
<p>The term DOM is used to refer to the API set made available to scripts in
Web applications, and does not necessarily imply the existence of an actual
<code>Document</code> object or of any other <code>Node</code> objects as
defined in the DOM Core specifications. <a
href="#DOM3Core">[DOM Level 3 Core]</a>
</p>
<p>A DOM attribute is said to be <em>getting</em> when its value is being
retrieved (such as by author script), and is said to be <em>setting</em> when
a new value is assigned to it. </p>
<p>The term "JavaScript" is used to refer to ECMA262, rather than the
official term ECMAScript, since the term JavaScript is more widely known. <a
href="#ECMA262">[ECMA262]</a>
</p>
<h2 id="user-timing-0"><span class="secno">4 </span>User Timing</h2>
<h3 id="introduction-1"><span class="secno">4.1 </span>Introduction</h3>
<p>This section is non-normative</p>
<p>The <a href="#the-usertiming-interface">User Timing</a> interface gives web developers access to a high precision, monotonically
increasing timestamp so they can better measure the performance characteristics of their
applications.</p>
<p>Throughout this work, the term "timestamp" refers to the number of milliseconds since midnight of January 1, 1970 (UTC).</p>
<h3 id="the-usertiming-interface"><span class="secno">4.2</span> The <code>UserTiming</code> Interface</h3>
<pre class="idl">
partial interface <a href="http://www.w3.org/TR/navigation-timing/#sec-window.performance-attribute">Performance</a> {
const unsigned short PERF_DEVELOPER_MARK = 2;
const unsigned short PERF_DEVELOPER_MEASURE = 3;
const string <a href="#ut-mark-fully-loaded">MARK_FULLY_LOADED</a> = "fullyLoaded";
const string <a href="#ut-mark-fully-visible">MARK_FULLY_VISIBLE</a> = "fullyVisible";
const string <a href="#ut-mark-above-the-fold">MARK_ABOVE_THE_FOLD</a> = "aboveTheFold";
const string <a href="#ut-mark-time-to-user-action">MARK_TIME_TO_USER_ACTION</a> = "timeToUserAction";
void <a href="#ut-mark">mark</a>(in <a class="noxref" href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMString">DOMString</a> markName);
Array <a href="#ut-getMarks">getMarks</a>(in optional <a class="noxref" href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMString">DOMString</a> markName);
void <a href="#ut-clearMarks">clearMarks</a>(in optional <a class="noxref" href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMString">DOMString</a> markName);
void <a href="#ut-measure">measure</a>(in <a class="noxref" href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMString">DOMString</a> measureName, in optional <a class="noxref" href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMString">DOMString</a> startMark, in optional <a class="noxref" href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMString">DOMString</a> endMark);
Array <a href="#ut-getMeasures">getMeasures</a>(in optional <a class="noxref" href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMString">DOMString</a> measureName);
void <a href="#ut-clearMeasures">clearMeasures</a>(in optional <a class="noxref" href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMString">DOMString</a> measureName);
};
</pre>
<div class="methods">
<h4 id="ut-mark"><code>mark</code> method</h4>
<p>This method stores a timestamp with the associated name (a "mark").</p>
<div class="parameters">
<p><b>Parameters</b></p>
<p>in <code>name</code> type of <a class="noxref" href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMString">DOMString</a></p>
<div class="parameterDefinition">
<p>The name associated with the timestamp.</p>
<p>Mark names may be re-used within the same document.
Each call to the <code>mark()</code> method stores a new timestamp
under the specified mark name.</p>
<p>The mark name cannot be the same name as any of the attributes in the
<code><a href="http://www.w3.org/TR/navigation-timing/#sec-navigation-timing-interface">PerformanceTiming</a></code> interface <a href="#NavigationTiming">[Navigation Timing]</a>.</p>
<p id="ut-standard-mark-names"><b>Standard Mark Names</b></p>
<p>The mark name may be one of the following Standard Mark Names. When using a Standard Mark Name, the user agent is responsible for storing
a new timestamp under the specified mark name.
The user agent does not validate that the usage of the Standard Mark Name is appropriate or consistent with its description.</p>
<code id="ut-mark-fully-loaded">MARK_FULLY_LOADED</code>
<div class="parameterDefinition">
<p>The time when the page is considered fully loaded as marked by the developer in their application.</p>
</div>
<code id="ut-mark-fully-visible">MARK_FULLY_VISIBLE</code>
<div class="parameterDefinition">
<p>The time when the page is considered completely visible to an end-user as marked by the developer in
their application.</p>
</div>
<code id="ut-mark-above-the-fold">MARK_ABOVE_THE_FOLD</code>
<div class="parameterDefinition">
<p>The time when all of the content in the visible viewport has been presented to the end-user as marked by
the developer in their application.</p>
</div>
<code id="ut-mark-time-to-user-action">MARK_TIME_TO_USER_ACTION</code>
<div class="parameterDefinition">
<p>The time of the first user interaction with the page during or after a navigation, such as scroll or click,
as marked by the developer in their application.</p>
</div>
</div>
<p><b>No Return Value</b></p>
<p><b>Exceptions</b></p>
<p>Throws a <code>SYNTAX_ERR</code> exception if the <em>markName</em> argument is the same name as an attribute in the
<code><a href="http://www.w3.org/TR/navigation-timing/#sec-navigation-timing-interface">PerformanceTiming</a></code> interface.</p>
</div>
</div>
<div class="methods">
<h4 id="ut-getMarks"><code>getMarks</code> method</h4>
<p>If the <em>markName</em> argument is not specified, this method must return all of the marks and their associated timestamps.</p>
<p>If the <em>markName</em> argument is specified, this method must return all of the timestamps for the specified mark name.</p>
<p>If the <em>markName</em> argument is specified but it does not exist, this method must return an empty array.</p>
<div class="parameters">
<p><b>Parameters</b></p>
<p>in <code>markName</code> type of <a class="noxref" href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMString">DOMString</a></p>
<div class="parameterDefinition">
<p>[optional] The name of the mark. If not specified, all marks are returned.</p>
</div>
<p><b>Return Value</b></p>
<code>Array</code>
<p>If the <em>markName</em> argument is not specified, the method returns an associative Array. Each key in the Array is a
mark name. The value associated with the mark name is an Array of timestamps for that mark. In JSON notation,
the data structure will look similar to this: <code>{ "mark1": [0, 1, 3], "mark2": [2] }</code></p>
<p>If the <em>markName</em> argument is specified, and the mark name exists, the method returns an Array of timestamps. In JSON notation,
the data structure will look similar to this: <code>[0, 1, 3]</code></p>
<p>If the <em>markName</em> argument is specified, and the mark name does not exist, the method returns an empty Array. In JSON notation,
the data structure will look similar to this: <code>[]</code></p>
<p>Timestamps will be listed in the order that the <code>mark()</code> method was called.</p>
<p>The returned Array is a copy of data at the time that the <code>getMarks()</code> method was called.</p>
<p><b>No Exceptions</b></p>
</div>
</div>
<div class="methods">
<h4 id="ut-clearMarks"><code>clearMarks</code> method</h4>
<p>If the <em>markName</em> argument is not specified, this method removes all marks and their associated timestamps.</p>
<p>If the <em>markName</em> argument is specified, this method removes all timestamps for the given mark name.</p>
<p>If the <em>markName</em> argument is specified but the specified <em>markName</em> does not exist, this method will do nothing.</p>
<div class="parameters">
<p><b>Parameters</b></p>
<p>in <code>markName</code> type of <a class="noxref" href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMString">DOMString</a></p>
<div class="parameterDefinition">
<p>[optional] The name of the mark whose timestamps should be cleared. If not specified, all marks will be cleared.</p>
</div>
<p><b>No Return Value</b></p>
<p><b>No Exceptions</b></p>
</div>
</div>
<div class="methods">
<h4 id="ut-measure"><code>measure</code> method</h4>
<p>This method stores the duration between two marks (measured in milliseconds) along with the associated name (a "measure").</p>
<p>The behavior of this method depends on which arguments are specified:</p>
<ul>
<li>If both the <em>startMark</em> and <em>endMark </em>arguments are not specified,
<code>measure()</code> will store the duration in milliseconds from
<a href="http://www.w3.org/TR/navigation-timing/#nt-fetch-start">fetchStart</a>
to the current time.</li>
<li>If the <em>startMark</em> argument is specified, but the <em>endMark </em>argument is not specified,
<code>measure()</code> will store the duration in
milliseconds from the most recent occurrence of the start mark to the current time.</li>
<li>If both the <em>startMark</em> and <em>endMark </em>arguments are specified, <code>measure()</code> will store the duration in
milliseconds from the most recent occurrence of the start mark to the most recent occurrence of the end mark.</li>
</ul>
<p>The <em>startMark</em> and <em>endMark</em> arguments may be the name of one of the attributes in the
<code><a href="http://www.w3.org/TR/navigation-timing/#sec-navigation-timing-interface">PerformanceTiming</a></code> interface <a href="#NavigationTiming">[Navigation Timing]</a>.
In this case, the value of that attribute is used as the timestamp.</p>
<div class="parameters">
<p><b>Parameters</b></p>
<p>in <code>name</code> type of <a class="noxref" href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMString">DOMString</a></p>
<div class="parameterDefinition">
<p>The name associated with the measure.</p>
<p>Measure names may be re-used within the same document.
Each call to the <code>measure()</code> method stores a new duration
under the specified measure name.</p>
<p>Measure names live independently from mark names.</p>
</div>
<p>in <code>startMark</code> type of <a class="noxref" href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMString">DOMString</a></p>
<div class="parameterDefinition">
<p>[optional] The name of the start mark.</p>
<p>If specified, the most recent timestamp of the start mark is used.</p>
<p>If not specified, <a href="http://www.w3.org/TR/navigation-timing/#nt-fetch-start">fetchStart</a> is used.</p>
<p>May be the name of one of the attributes in the
<code><a href="http://www.w3.org/TR/navigation-timing/#sec-navigation-timing-interface">PerformanceTiming</a></code> interface <a href="#NavigationTiming">[Navigation Timing]</a>.
In this case, the value of that attribute is used as the start timestamp.</p>
</div>
<p>in <code>endMark</code> type of <a class="noxref" href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMString">DOMString</a></p>
<div class="parameterDefinition">
<p>[optional] The name of the end mark.</p>
<p>If specified, the most recent timestamp of the end mark is used.</p>
<p>If not specified, the current time is used.</p>
<p>May be the name of one of the attributes in the
<code><a href="http://www.w3.org/TR/navigation-timing/#sec-navigation-timing-interface">PerformanceTiming</a></code> interface <a href="#NavigationTiming">[Navigation Timing]</a>.
In this case, the value of that attribute is used as the end timestamp.</p>
</div>
<p><b>No Return Value</b></p>
<p><b>Exceptions</b></p>
<p>Throws a <code>SYNTAX_ERR</code> exception if the start mark or end mark does not exist.</p>
<p>Throws a <code>SYNTAX_ERR</code> exception if the duration (the end mark timestamp minus the start mark timestamp) is negative.</p>
<p>Throws a <code>SYNTAX_ERR</code> exception if either <code>startMark</code> or <code>endMark</code> argument, or both, have the same name as a
<code><a href="http://www.w3.org/TR/navigation-timing/#sec-navigation-timing-interface">PerformanceTiming</a></code> attribute with a timestamp value of 0 <a href="#NavigationTiming">[Navigation Timing]</a>.</p>
</div>
</div>
<div class="methods">
<h4 id="ut-getMeasures"><code>getMeasures</code> method</h4>
<p>If the <em>measureName</em> argument is not specified, this method must return all of the measures and their associated durations.</p>
<p>If the <em>measureName</em> argument is specified, this method must return all of the durations for the specified measure name.</p>
<p>If the <em>measureName</em> argument is specified but it does not exist, this method must return an empty array.</p>
<div class="parameters">
<p><b>Parameters</b></p>
<p>in <code>measureName</code> type of <a class="noxref" href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMString">DOMString</a></p>
<div class="parameterDefinition">
<p>[optional] The name of the measure to return. If not specified, all measures are returned.</p>
</div>
<p><b>Return Value</b></p>
<code>Array</code>
<p>If the <em>measureName</em> argument is not specified, the method returns an associative Array. Each key in the Array is a
measure name. The value associated with the measure name is an Array of durations for that measure. In JSON notation,
the data structure will look similar to this: <code>{ "measure1": [0, 5, 1], "measure2": [3] }</code></p>
<p>If the <em>measureName</em> argument is specified, and the measure name exists, the method returns an Array of durations. In JSON notation,
the data structure will look similar to this: <code>[0, 5, 1]</code></p>
<p>If the <em>measureName</em> argument is specified, and the measure name does not exist, the method returns an empty Array. In JSON notation,
the data structure will look similar to this: <code>[]</code></p>
<p>Durations will be listed in the order that the <code>measure()</code> method was called.</p>
<p>The returned Array is a copy of data at the time that the <code>getMeasures()</code> method was called.</p>
<p><b>No Exceptions</b></p>
</div>
</div>
<div class="methods">
<h4 id="ut-clearMeasures"><code>clearMeasures</code> method</h4>
<p>If the <em>measureName</em> argument is not specified, this method removes all measures and their associated durations.</p>
<p>If the <em>measureName</em> argument is specified, this method removes all durations for the given measure name.</p>
<p>If the <em>measureName</em> argument is specified but the specified <em>measureName</em> does not exist, this method will do nothing.</p>
<div class="parameters">
<p><b>Parameters</b></p>
<p>in <code>measureName</code> type of <a class="noxref" href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMString">DOMString</a></p>
<div class="parameterDefinition">
<p>[optional] The name of the measure whose durations should be cleared. If not specified, all measures will be cleared.</p>
</div>
<p><b>No Return Value</b></p>
<p><b>No Exceptions</b></p>
</div>
</div>
<h3 id="the-performancemark-interface"><span class="secno">4.3</span> The <code>PerformanceMark</code> Interface</h3>
<pre class="idl">
interface PerformanceMark : <a href="http://www.w3.org/TR/performance-timeline/#pt-performanceEntry-interface">PerformanceEntry</a> {
}
</pre>
<p>
The <a href="#the-performancemark-interface">PerformanceMark</a> interface also
exposes marks created via the <code><a href="#ut-mark">mark()</a></code>
method to the
<a href="http://www.w3.org/TR/performance-timeline/#sec-performance-timeline">Performance Timeline</a>. The <a href="#the-performancemark-interface">PerformanceMark</a>
interface extends the following attributes of the <a href="http://www.w3.org/TR/performance-timeline/#pt-performanceEntry-interface">
PerformanceEntry</a>
interface:
</p>
<div class="parameters">
<p>The <code>name</code> attribute will return the mark's name.</p>
<p>The <code>entryType</code> attribute will return <code>PERF_DEVELOPER_MARK</code>.</p>
<p>The <code>startTime</code> attribute will return the mark's timestamp.</p>
<p>The <code>duration</code> attribute will return 0.</p>
</div>
<h3 id="the-performancemeasure-interface"><span class="secno">4.4</span> The <code>PerformanceMeasure</code> Interface</h3>
<pre class="idl">
interface PerformanceMeasure : <a href="http://www.w3.org/TR/performance-timeline/#pt-performanceEntry-interface">PerformanceEntry</a> {
}
</pre>
<p>
The <a href="#the-performancemeasure-interface">PerformanceMeasure</a> interface also
exposes measures created via the <code><a href="#ut-measure">measure()</a></code>
method to the <a href="http://www.w3.org/TR/performance-timeline/#sec-performance-timeline">Performance Timeline</a>. The <a href="#the-performancemeasure-interface">PerformanceMeasure</a> interface extends the following attributes of the <a href="http://www.w3.org/TR/performance-timeline/#pt-performanceEntry-interface">PerformanceEntry</a> interface:
</p>
<div class="parameters">
<p>The <code>name</code> attribute will return the measure's name.</p>
<p>The <code>entryType</code> attribute will return <code>PERF_DEVELOPER_MEASURE</code>.</p>
<p>The <code>startTime</code> attribute will return the timestamp of the measure's start mark.</p>
<p>The <code>duration</code> attribute will return the duration of the measure.</p>
</div>
<h3 id="vendor-prefixes">4.5 Vendor Prefixes</h3>
<p>Vendor-specific proprietary user agent extensions to this specification are strongly discouraged.
If such extensions are needed, e.g. for experimental purposes, vendors must use the following extension mechanisms:</p>
<p>If the extension to be added is a <a href="#ut-standard-mark-names">Standard Mark Name</a>, the Standard Mark Name must:</p>
<ul>
<li>Follow this naming convention: [VENDORPREFIX]_[STANDARD_MARK_NAME], where [VENDORPREFIX] is a name that identifies the vendor and [STANDARD_MARK_NAME] is the name given to the Standard Mark.</li>
</ul>
<h2 id="monotonic-clock"><span class="secno">5 </span>Monotonic Clock</h2>
<p>The timestamps stored within the interface must monotonically increase to ensure they are not
affected by adjustments to the system clock. The difference between any two chronologically
recorded timestamps must never be negative. The user agent must record the system clock at the beginning
of the navigation and define subsequent timestamps in terms of a monotonic clock measuring time elapsed
from the beginning of the navigation.
</p>
<h2 id="privacy"><span class="secno">6 </span>Privacy</h2>
<p>This section is non-normative.</p>
<p>UserTiming potentially exposes information about specific activities on a page. This information must explicitly
not be accessible in cross-domain situations and made available to only the server where the root document originates.</p>
<h2 id="security"><span class="secno">7 </span>Security</h2>
<p>This section is non-normative.</p>
<p>Similar to the discussion in the Privacy section. </p>
<h2 class="no-num" id="acknowledgements">Acknowledgements</h2>
<p>Thanks to James Simonsen, Jason Weber, Karen Anderson, Nic Jansma, Steve Souders, and Tony Gentilcore for their useful comments that led to changes to this specification and their contributions to this work.</p>
<h2 class="no-num" id=references>References</h2>
<dl>
<dt><a name='rfc2119' id='rfc2119'>[IETF RFC 2119]</a></dt>
<dd>
<cite><a href='http://www.ietf.org/rfc/rfc2119.txt'>Key words for use in RFCs to Indicate Requirement Levels</a></cite>, Scott Bradner, Author. Internet Engineering Task Force, March 1997. Available at <a href='http://www.ietf.org/rfc/rfc2119.txt'>http://www.ietf.org/rfc/rfc2119.txt</a>.
</dd>
<dt>[<a name="DOM3Core" id='DOM3Core'>DOM Level 3 Core</a>]</dt>
<dd>
<cite><a href="http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/">Document Object Model Level 3 Core
Specification</a></cite>, A. Le Hors, et al., Editors. World
Wide Web Consortium, 7 April 2004. This version of the Document
Object Model Level 3 Core Recommendation is
http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407. The <a class="normative" href="http://www.w3.org/TR/domcore/">latest version of
DOM Core</a> is available at
http://www.w3.org/TR/domcore/.
</dd>
<dt>[<a name="ECMA262" id="ECMA262">ECMA-262</a>]</dt>
<dd>
<cite><a href='http://www.ecma-international.org/publications/standards/Ecma-262.htm'>ECMAScript Language Specification</a></cite>, 5<sup>th</sup>
Edition. ECMA International, Standard
ECMA-262, December 2009. This version of the ECMAScript
Language is available from http://www.ecma-international.org/publications/standards/Ecma-262.htm.
</dd>
<dt>[<a name="NavigationTiming" id="NavigationTiming">Navigation Timing</a>]</dt>
<dd><cite><a href='http://www.w3.org/TR/2011/CR-navigation-timing-20110602/'>Navigation Timing</a></cite>, Zhiheng Wang, Editor. World Wide Web Consortium, June 2011. This version of the Navigation Timing specification is available from http://www.w3.org/TR/2011/CR-navigation-timing-20110602/. The <a href='http://www.w3.org/TR/navigation-timing/'>latest version of Navigation Timing</a> is available at http://www.w3.org/TR/navigation-timing/.</dd>
<dt>[<a name="PerformanceTimeline" id="PerformanceTimeline">Performance Timeline</a>]</dt>
<dd><cite><a href='http://www.w3.org/TR/performance-timeline/'>Performance Timeline</a></cite>, Jatinder Mann, et al, Editors. World Wide Web Consortium, September 2011. This version of the Performance Timeline specification is available from http://www.w3.org/TR/performance-timeline/. The <a href='http://www.w3.org/TR/performance-timeline/'>latest version of Performance Timeline</a> is available at http://www.w3.org/TR/performance-timeline/.</dd>
<dt>[<a name="WebIDL" id="WebIDL">Web IDL</a>]</dt>
<dd><cite><a href='http://www.w3.org/TR/2011/WD-WebIDL-20110712/'>Web IDL</a></cite>, Cameron McCormack, Editor. World Wide Web Consortium, July 2011. This version of the Web IDL specification is available from http://www.w3.org/TR/2011/WD-WebIDL-20110712/. The <a href='http://www.w3.org/TR/WebIDL/'>latest version of Web IDL</a> is available at http://www.w3.org/TR/WebIDL/.</dd>
</dl>
</div>
</body>
</html>