[webkit-dev] Implementing WebTiming as a part of HTML5

Pavel Feldman pfeldman at chromium.org
Thu Oct 22 12:37:13 PDT 2009


I've been asked to look at the WebTiming proposal wrt implementing it in
WebKit. Any objections / suggestions or hints? Please find proposal brief
below.

Pavel

<< Pasting proposal brief below >>

User latency is an important quality benchmark for Web Applications. While
JavaScript-based mechanisms can provide comprehensive instrumentations for user
latency measurements within an application, in many cases, they are unable to
provide a complete end-to-end latency picture.

For example, the following Javascript shows the time it take to fully load a
page:

<html>
<head>
<script type="text/javascript">
var start = new Date().getTime();
function onLoad() {
  var now = new Date().getTime();
  var latency = now - start;
  alert("page loading time: " + latency);
}
<script>
</head>
<body onload="onLoad()">
<!- Main page body goes from here. -->
</body>
</html>

The script calculates the time it takes to load the page after the first bit of
JavaScript in the head is executed, but it does not give any information about
the time it takes to get the page from the server.

To address the need for complete information on the user experience, this
document introduces the Timing interface. This interface allows JavaScript
mechanisms to provide complete client-side latency measurements within
applications. With the proposed interface, the previous example could be
modified to provide information about user's perceived page load time.

The following script calculates how much time has elapsed since the occurance
of a navigation event, such as the mouse click on a link.

<html>
<head>
<script type="text/javascript">
function onLoad() {
  var now = new Date().getTime();
  var latency = now - window.pageTiming.navigationTime;
  alert("User-perceived page loading time: " + latency);
}
<script>
</head>
<body onload="onLoad()">
<!- Main page body goes from here. -->
</body>
</html>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20091022/db0cc26d/attachment.html>


More information about the webkit-dev mailing list