New issue
Advanced search Search tips

Issue 739277 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Aug 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug

Blocking:
issue 752574



Sign in to add a comment

[HR-Time] Implement performance.timeOrigin attribute

Project Member Reported by igrigo...@google.com, Jul 5 2017

Issue description

Use case and full example: https://www.w3.org/TR/hr-time-3/#examples

> A developer may wish to construct a timeline of their entire application, including
> events from dedicated or shared workers, which have different time origin's. To 
> display such events on the same timeline, the application can translate the 
> DOMHighResTimeStamp's with the help of the performance.timeOrigin attribute.

Definition: https://www.w3.org/TR/hr-time-3/#dom-performance-timeorigin

> The timeOrigin attribute must return a DOMHighResTimeStamp representing the high
> resolution time of the time origin timestamp of the global object.

---

Also, contribute tests for it @ https://github.com/w3c/web-platform-tests/tree/master/hr-time

 
Cc: igrigo...@chromium.org
Labels: Hotlist-PerformanceAPIs

Comment 2 by npm@chromium.org, Jul 5 2017

Components: Blink>PerformanceAPIs
Status: Assigned (was: Untriaged)
Project Member

Comment 3 by sheriffbot@chromium.org, Jul 11 2017

Labels: Hotlist-Google

Comment 4 by npm@chromium.org, Jul 18 2017

Could you clarify the definition? Let's just consider the most substantial part: it is the "sum of the high resolution Unix time at which the global monotonic clock is zero and the time value of the global monotonic clock at which the time origin is zero".

How do we calculate the Unix time being referred to? I thought the point of the monotonic clock is to prevent using unreliable system clocks. And what does 'time value [...] at which time origin is zero' mean? From what I understand, given an object, the time origin is a fixed timestamp.

I have a CL with what I would expect the implementation to be (just a way to expose a high resolution timestamp of the time origin) but I'd like to first understand the definition in the spec.
https://chromium-review.googlesource.com/c/574829
There are a few moving bits here:
- each renderer has a time origin and own monotonic clock
- browser has a *global* monotonic clock shared by renderers, and a unix timestamp of when the global clock is zero

To obtain "timeOrigin" value for a render, you take the unix timestamp of when global monotonic clock is zero, and add the time value of the global monotonic clock for when time origin of the renderer is zero (i.e. when it was launched). 

Hope that helps clarify things a bit?

> I thought the point of the monotonic clock is to prevent using unreliable system clocks.

Right, the resulting value is tied to a unix timestamp, but there is no guarantee that it's accurate.. Hence the "The time origin timestamp and the value returned by Date.now() executed at "zero time" can differ because the former is recorded with respect to a global monotonic clock that is not subject to system and user clock adjustments, clock skew, and so on" disclaimer in the spec.


Labels: Hotlist-Interop
Project Member

Comment 7 by bugdroid1@chromium.org, Jul 26 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/354011b3189d9bb88d6f5734523e6714cdba7bcf

commit 354011b3189d9bb88d6f5734523e6714cdba7bcf
Author: Nicolas Pena <npm@chromium.org>
Date: Wed Jul 26 05:47:47 2017

Implement Performance.timeOrigin

This CL adds performance.timeOrigin under an experimental flag. Definition:
https://www.w3.org/TR/hr-time-3/#dom-performance-timeorigin

The unix time for when the global monotonic clock is 0 is calculated at
the time when the first Performance object is created as the system time
minus the monotonic clock time.

This CL also adds a test for this attribute.

Bug:  chromium:739277 ,  chromium:747989 
Change-Id: I5e8cf4e098615052bd5db35956dcfcdd7dd44b90
Reviewed-on: https://chromium-review.googlesource.com/583636
Commit-Queue: Nicolás Peña <npm@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Timothy Dresser <tdresser@chromium.org>
Cr-Commit-Position: refs/heads/master@{#489562}
[add] https://crrev.com/354011b3189d9bb88d6f5734523e6714cdba7bcf/third_party/WebKit/LayoutTests/external/wpt/hr-time/timeOrigin.html
[modify] https://crrev.com/354011b3189d9bb88d6f5734523e6714cdba7bcf/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-properties-after-frame-navigated-expected.txt
[modify] https://crrev.com/354011b3189d9bb88d6f5734523e6714cdba7bcf/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-and-gced-expected.txt
[modify] https://crrev.com/354011b3189d9bb88d6f5734523e6714cdba7bcf/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-expected.txt
[modify] https://crrev.com/354011b3189d9bb88d6f5734523e6714cdba7bcf/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-navigated-expected.txt
[modify] https://crrev.com/354011b3189d9bb88d6f5734523e6714cdba7bcf/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-and-gced-expected.txt
[modify] https://crrev.com/354011b3189d9bb88d6f5734523e6714cdba7bcf/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-expected.txt
[modify] https://crrev.com/354011b3189d9bb88d6f5734523e6714cdba7bcf/third_party/WebKit/LayoutTests/fast/dom/Window/resources/window-property-collector.js
[modify] https://crrev.com/354011b3189d9bb88d6f5734523e6714cdba7bcf/third_party/WebKit/LayoutTests/fast/dom/Window/window-properties-performance-expected.txt
[modify] https://crrev.com/354011b3189d9bb88d6f5734523e6714cdba7bcf/third_party/WebKit/LayoutTests/virtual/service-worker-navigation-preload-disabled/webexposed/global-interface-listing-expected.txt
[modify] https://crrev.com/354011b3189d9bb88d6f5734523e6714cdba7bcf/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
[modify] https://crrev.com/354011b3189d9bb88d6f5734523e6714cdba7bcf/third_party/WebKit/Source/core/timing/Performance.cpp
[modify] https://crrev.com/354011b3189d9bb88d6f5734523e6714cdba7bcf/third_party/WebKit/Source/core/timing/Performance.idl
[modify] https://crrev.com/354011b3189d9bb88d6f5734523e6714cdba7bcf/third_party/WebKit/Source/core/timing/PerformanceBase.cpp
[modify] https://crrev.com/354011b3189d9bb88d6f5734523e6714cdba7bcf/third_party/WebKit/Source/core/timing/PerformanceBase.h
[modify] https://crrev.com/354011b3189d9bb88d6f5734523e6714cdba7bcf/third_party/WebKit/Source/core/timing/PerformanceUserTiming.cpp
[modify] https://crrev.com/354011b3189d9bb88d6f5734523e6714cdba7bcf/third_party/WebKit/Source/core/timing/WorkerPerformance.idl
[modify] https://crrev.com/354011b3189d9bb88d6f5734523e6714cdba7bcf/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5

Blocking: 752574
Project Member

Comment 9 by bugdroid1@chromium.org, Aug 18 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/6239bc6b7d27a33b9498fb237dd8a0553cfe3362

commit 6239bc6b7d27a33b9498fb237dd8a0553cfe3362
Author: Nicolas Pena <npm@chromium.org>
Date: Fri Aug 18 19:18:46 2017

Ship performance.timeOrigin

Intent to Ship:
https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/3AISwpQNoNs

Bug:  chromium:747989 ,  chromium:739277 
Change-Id: Ib19681cc608dd5e7554e794241cf00cd126e3253
Reviewed-on: https://chromium-review.googlesource.com/619246
Reviewed-by: Tim Volodine <timvolodine@chromium.org>
Reviewed-by: Philip Jägenstedt <foolip@chromium.org>
Commit-Queue: Nicolás Peña <npm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#495642}
[modify] https://crrev.com/6239bc6b7d27a33b9498fb237dd8a0553cfe3362/android_webview/tools/system_webview_shell/test/data/webexposed/global-interface-listing-expected.txt
[modify] https://crrev.com/6239bc6b7d27a33b9498fb237dd8a0553cfe3362/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-expected.txt
[modify] https://crrev.com/6239bc6b7d27a33b9498fb237dd8a0553cfe3362/third_party/WebKit/LayoutTests/platform/win/virtual/stable/webexposed/global-interface-listing-expected.txt
[modify] https://crrev.com/6239bc6b7d27a33b9498fb237dd8a0553cfe3362/third_party/WebKit/Source/core/timing/Performance.idl
[modify] https://crrev.com/6239bc6b7d27a33b9498fb237dd8a0553cfe3362/third_party/WebKit/Source/core/timing/WorkerPerformance.idl
[modify] https://crrev.com/6239bc6b7d27a33b9498fb237dd8a0553cfe3362/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5

Comment 10 by npm@chromium.org, Aug 18 2017

Status: Fixed (was: Assigned)

Sign in to add a comment