W3C home > Mailing lists > Public > public-web-perf@w3.org > November 2010

[Web Timing] Proposed Resource Timing

From: Anderson Quach <aquach@microsoft.com>
Date: Wed, 3 Nov 2010 01:45:35 +0000
To: public-web-perf <public-web-perf@w3.org>
Message-ID: <1E1FF4102DEA7A40AF9CC342044ECE5D2E26372D@TK5EX14MBXW603.wingroup.windeploy.ntdev.microsoft.com>
Hi All,
Here's a proposal Nic Jansma and I discussed for Resource Timing in our conference call on 10/20/2010 [1]. You will find an approach where the user agent maintains and tracks the resource timings all the time.
There are a few assumptions, the full-timeline is only available for resources that have the same origin as the root document. A much more limited timeline is available to cross-domain resources, fetchStart to ~loadEventStart, loadEventEnd.
There's also the issue that CSS-images and multiple CSS-images are not HTMLElements and do not have a corresponding onload attribute. Thus the introduction of a new attribute called fetchEnd, which corresponds to ~responseEnd.
Anderson Quach
IE Program Manager
[1] http://www.w3.org/2010/10/20-webperf-minutes.html

Resource Timing Goals

1.       Ease of use and access to the resource timings - provide a usage pattern that align closely with Navigation Timing and that produces predictable results.

2.       Security conscious -information about what an the end-user had been doing on a previous page navigation must not be disclosed.

3.       Performs well in user agents - user agents must not be overly burdened with the collection and buffering of the information used to track resource timings that it affects web browsing.
[Supplemental] Performance {
  PerformanceResourceTimingList getResourceTimings ([optional] in unsigned short initiatorType);
  void setResourceTimingBufferSize (in unsigned long length);
  void clearResourceTimings();
  attribute Function onbufferfull;

interface PerformanceResourceTimingList{
   readonly attribute unsigned long length;
   getter ResourcePerformanceTiming(in unsigned long index);

interface PerformanceResourceTiming{
  const unsigned short RESOURCE_LINK = 1;
  const unsigned short RESOURCE_CSSIMAGE = 2;
  const unsigned short RESOURCE_SCRIPT = 3;
  const unsigned short RESOURCE_IMG = 4;
  const unsigned short RESOURCE_OBJECT = 5;
  const unsigned short RESOURCE_FRAME = 6;
  const unsigned short RESOURCE_XMLHTTPREQUEST = 7;
  const unsigned short RESOURCE_EMBED = 8;
  const unsigned short RESOURCE_AUDIO = 9;
  const unsigned short RESOURCE_VIDEO = 10;
  const unsigned short RESOURCE_OTHER = 11;
  const unsigned short RESOURCE_RESERVED_MS_HTC = 12;

  readonly attribute unsigned short initiatorType;

  readonly attribute DOMString url;
  readonly attribute unsigned long long redirectStart;
  readonly attribute unsigned long long redirectEnd;
  readonly attribute unsigned long long fetchStart;
  readonly attribute unsigned long long domainLookupStart;
  readonly attribute unsigned long long domainLookupEnd;
  readonly attribute unsigned long long connectStart;
  readonly attribute unsigned long long connectEnd;
  readonly attribute unsigned long long requestStart;
  readonly attribute unsigned long long responseStart;
  readonly attribute unsigned long long responseEnd;
  readonly attribute unsigned long long fetchEnd;
  readonly attribute unsigned long long loadEventStart;
  readonly attribute unsigned long long loadEventEnd;

The getResourceTimings interface retrieves a buffered array of PerformanceResourceTiming as stored by the user agent. When supplied with an initiatorType, this will return a filtered list. When the origin of the root document differs from that of the resources, only fetchStart and if available, fetchEnd, loadEventStart and loadEventEnd are available, otherwise all attributes are available.
The default number of buffers returned is a MAX of 1000 PerformanceResourceTiming.
[optional] in unsigned short initiatorType
The initiatorType parameter specifies which resource types to retrieve. If no initiatorType is supplied all resource timings are returned.
A list of PerformanceResourceTiming.

The method setResourceTimingBufferSize is a setter that expands the buffered array used to store a list of PerformanceResourceTiming.
in unsigned long length
The length parameter allows the site developer to specify a buffer size that is greater or smaller than the default of 1000 PerformanceResourceTiming.
no return

The method clearResourceTimings clears the buffered array used to store a list of PerformanceResourceTiming.  Only the first 1000 PerformanceResourceTiming will be stored. Unless otherwise specified by setResourceTimingBufferSize().
no parameters
no return

The callback onbufferfull is triggered when the buffer used to store a list of PerformanceResourceTiming is full. The callback can be used to package existing PerformanceResourceTiming list and clear the buffered PerformanceResourceTiming list. While executing the onbufferfull callback, PerformanceResourceTiming will continue to be collected beyond the initial restriction of the first 1000 PerformanceResourceTiming until one of the following occurs:

1.       clearResourceTimings() is called - The PerformanceResourceTimingList will begin with the 1001th item if it exists and the first 1000 elements are released. If the 1001th item does not exist the buffer is cleared. The max length of the PerformanceResourceTimingList is still 1000 unless otherwise specified by setResourceTimingBufferSize().

2.       setResourceTimingBufferSize() is called - The PerformanceResourceTimingList will extend and / or truncate to the buffer size specified.

3.       Neither clearResourceTimings() or setResourceTimingBufferSize() is called during the execution of the onbufferfull callback - no updates are made to the PerformanceResourceTimingList.
If the onbufferfull callback is not registered, there are guarantees around preserving PerformanceResourceTimingList beyond the first 1000 items.
no parameters
no return

A list of PerformanceResourceTiming.


The PerformanceResourceTiming attribute represents the timing information related to an element<http://dev.w3.org/html5/spec/Overview.html#elements>. Each of the following elements must expose its timing information during a page load using the interfaces defined in this work: iframe<http://dev.w3.org/html5/spec/Overview.html#the-iframe-element>, img<http://dev.w3.org/html5/spec/Overview.html#the-img-element>, script<http://dev.w3.org/html5/spec/Overview.html#script>, object<http://dev.w3.org/html5/spec/Overview.html#the-object-element>, embed<http://dev.w3.org/html5/spec/Overview.html#the-embed-element> and link<http://dev.w3.org/html5/spec/Overview.html#the-link-element> with the link type of stylesheet<http://dev.w3.org/html5/spec/Overview.html#link-type-stylesheet>. The term "resource" is also used to refer to these elements in this work.
This is an enumerated type used to identify the initiator of the resource download. The enumerated type RESOURCE_OTHER is used for user-agent specific resources that are initiated from the load and execution of the root document.
The ability to access all the PerformanceResourceTiming is restricted to the same origin policy. Potentially we can further allow permissions with CORS [1].
[1] http://www.w3.org/TR/cors/
Received on Wednesday, 3 November 2010 01:46:52 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:04:29 UTC