Copyright © 2011 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C liability, trademark and document use rules apply.
This specification defines an interface for web applications to access timing information related to navigation and elements.
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 W3C technical reports index at http://www.w3.org/TR/.
This is a First Public Working Draft of "Performance Timeline".
Please send comments to public-web-perf@w3.org (archived) with [PerformanceTimeline] at the start of the subject line.
This document is produced by the Web Performance Working Group. The Web Performance Working Group is part of the Rich Web Clients Activity in the W3C Interaction Domain.
You can find the latest Editor's Draft of this document in the W3C's Mercurial repository, which is updated on a regular basis.
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.
This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures 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 Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.
Implementers should be aware that this document is not stable. Implementers who are not taking part in the discussions are likely to find the specification changing out from under them in incompatible ways. Vendors interested in implementing this document before it eventually reaches the Candidate Recommendation stage should join the aforementioned mailing lists and take part in the discussions.
This section is non-normative.
This specification introduces a unified interface to store and retrieve performance metric data. This specification does not cover individual performance metric interfaces.
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.
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 RFC 2119. For readability, these words do not appear in all uppercase letters in this specification.
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.
Some conformance requirements are phrased as requirements on attributes, methods or objects. Such requirements are to be interpreted as requirements on user agents.
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.)
The IDL fragments in this specification must be interpreted as required for conforming IDL fragments, as described in the Web IDL specification. [Web IDL]
The construction "a Foo object", where Foo is actually an interface, is sometimes used instead of
the more accurate "an object implementing the interface Foo". 
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
Document object or of any other Node objects as
defined in the DOM Core specifications.
A DOM attribute is said to be getting when its value is being retrieved (such as by author script), and is said to be setting when a new value is assigned to it.
The term "JavaScript" is used to refer to ECMA-262, rather than the official term ECMAScript, since the term JavaScript is more widely known.
Throughout this work, time is measured in milliseconds since midnight of January 1, 1970 (UTC).
All interfaces that participate in the Performance Timeline, such as the PerformanceResourceTiming, PerformanceMark, and PerformanceMeasure interfaces, must adhere to the following rules:
getEntries,
		getEntriesByType, and
		getEntriesByName methods
	const unsigned short PERF_[METRIC] = [VALUE],
where [METRIC] is the metric name and [VALUE]
		is a unique unsigned short that has not been already taken by another metric name.
PerformanceEntry  
interfaceinterface PerformanceEntry {
  readonly attribute DOMString name;
  readonly attribute unsigned long long startTime;
  readonly attribute unsigned short entryType;
  readonly attribute unsigned long long duration;
};
name attribute
	The name attribute must return the identifier for this PerformanceEntry object. This
	identifier does not have to be unique. 
startTime attribute
	The startTime attribute must return the first recorded timestamp
	of this performance metric.
entryType attribute
	The entryType attribute must return a const unsigned short exposed on window.performance 
    that defines the type of the interface represented by this PerformanceEntry object.
	
duration attribute
	The duration attribute must return the duration of the entire event being recorded by this PerformanceEntry. Typically, this would be the 
	time difference between the last recorded timestamp and the first recorded timestamp of this PerformanceEntry. A performance metric may choose
	to return a duration of 0, if the duration concept doesn't apply.
PerformanceEntryList  
interfaceinterface PerformanceEntryList {
  readonly attribute unsigned long length;
  PerformanceEntry item(in unsigned long index);
};
The PerformanceEntryList interface defines an array of PerformanceEntry objects.
length attribute
 The length attribute must return the number of PerformanceEntry objects in the 
 PerformanceEntryList. 
item methodThe item method retrieves the
		PerformanceEntry object in the location index from the PerformanceEntryList.  
    
Parameter
in unsigned long index
This method retrieves the
		           PerformanceEntry object in the location 
                   index from the PerformanceEntryList.
                
Return value
A PerformanceEntry object.
Exceptions
Throws an INDEX_SIZE_ERR exception if the index argument is negative, or greater than length.
window.performance 
attributeinterface Performance {
  PerformanceEntryList getEntries();
  PerformanceEntryList getEntriesByType(in unsigned short entryType);
  PerformanceEntryList getEntriesByName(in DOMString name, in optional unsigned short entryType);
};
The window.performance attribute provides a hosting area for performance measurement related attributes and methods.
getEntries methodThe getEntries method retrieves a 
		PerformanceEntryList that contains all PerformanceEntry objects in chronological order.
    
getEntriesByType methodThe getEntriesByType method retrieves a 
		PerformanceEntryList that contains PerformanceEntry objects, in chronological order, 
		that have the same value for the entryType attribute of PerformanceEntry as the entryType parameter.
    
Parameter
in unsigned short entryType
						The PerformanceEntryList must contain PerformanceEntry objects
						that have the same value for the entryType attribute of PerformanceEntry as the entryType parameter.
						If no such PerformanceEntry objects exist, the PerformanceEntryList
						must be empty.
					
Return value
A PerformanceEntryList object.No exceptions
getEntriesByName method
		The getEntriesByName method retrieves a
		PerformanceEntryList that contains PerformanceEntry objects, in chronological order, 
		that have the same value for the name attribute of PerformanceEntry as the name parameter 
		and, if specified, have the same value for the entryType attribute of PerformanceEntry as the entryType parameter.
    
Parameter
in DOMString name
						The PerformanceEntryList must contain PerformanceEntry objects
						that have the same value for the name attribute of PerformanceEntry as the name parameter. 
						If no such PerformanceEntry objects exist, the PerformanceEntryList must be empty.
					
in optional unsigned short entryType
						The PerformanceEntryList must only contain PerformanceEntry objects
						that have the same value for the entryType attribute of PerformanceEntry as the entryType parameter 
						and have the same value for the name attribute of PerformanceEntry as the name parameter. 
						If no such PerformanceEntry objects exist, the PerformanceEntryList
						must be empty.
					
Return value
A PerformanceEntryList object.No exceptions
PerformanceTiming 
interfaceThe PerformanceTiming interface does not extend 
the PerformanceEntry interface. However, when the getEntriesByType and
getEntriesByName methods are called with the entryType argument of PERF_NAVIGATION,
a PerformanceEntryList with a PerformanceEntry object with the following values must be returned:
The name attribute will return the "document" DOMString.
The entryType attribute will return PERF_NAVIGATION.
The startTime attribute will return a timestamp with the same value as navigationStart.
The duration attribute will return a timestamp equal to the difference between loadEventEnd and navigationStart, respectively.
I would like to offer my sincere thanks to all the people that I have been in touch with regarding this draft for their reviews and feedback.