Re: [HighResTime] Web Worker support

I'm looking for deltas while inside the workers but also must be able to
compare times between pages and their workers (and other external contexts
such as servers/etc).

In the case of dedicated workers this is possible as you've spec'ed, as the
times from now() in the page and all created workers will line up correctly
(now()=50 in the page has the same wall time as now()=50 in a worker).

In the case of shared workers, however, it wouldn't be possible to know how
now()=50 in a page lines up to now()=50 in a shared worker. At least, not
without a nasty hack that I'm currently using because
performance.originTime doesn't exist yet... :)

Something like performance.originTime would be very much appreciated!
Having that on the interface would make it possible to get this value in
all contexts without any guesswork, and also solve the very real issue I've
encountered with navigationStart being a millisecond value. It's not
currently possible to take a time value from now() and compute an accurate
wall time *without guessing*. For example, I have this code to try to get a
more accurate value than navigationStart that something like originTime
would eliminate:
https://github.com/google/tracing-framework/blob/master/src/wtf/wtf.js#L69

This allows me to compute high resolution wall time from now(), but if this
could be avoided and a high resolution wall time could be obtained in
pages/all worker types it'd make using the API much easier and much more
accurate. If this was something that could make it into this v2 spec I'd be
very happy to delete all my hacks around it :)



On Thu, Apr 18, 2013 at 10:44 AM, Jatinder Mann <jmann@microsoft.com> wrote:

>  Ben,****
>
> ** **
>
> If you’re just looking at deltas, differences between two time values, the
> origin shouldn’t matter. Is there a case where deltas wouldn’t be good
> enough and you would want the absolute numbers?****
>
> ** **
>
> If we were are to provide the origin time as a separate value (e.g.,
> performance.originTime), it would need to be in the same sub-millisecond
> resolution in order to be comparable with other DOMHighResTimeStamps; the
> spec currently suggests one thousandth of a millisecond. Double precision
> may be able to support that for milliseconds since Unix epoch.****
>
> ** **
>
> Thanks,****
>
> Jatinder****
>
> ** **
>
> *From:* Ben Vanik [mailto:benvanik@google.com]
> *Sent:* Wednesday, April 17, 2013 4:02 PM
> *To:* Jatinder Mann
> *Cc:* James Robinson; public-web-perf; James Simonsen
>
> *Subject:* Re: [HighResTime] Web Worker support****
>
> ** **
>
> Thanks for doing this Jatinder! I'm really excited to see access to
> performance.now() in workers!****
>
> ** **
>
> How does one determine the navigationStart-like value for shared workers?
> In order to try to correlate times between shared workers and the pages
> that launch them, it's important to be able to map the relative times
> returned by now.****
>
> ** **
>
> On Tue, Apr 16, 2013 at 5:05 PM, Jatinder Mann <jmann@microsoft.com>
> wrote:****
>
>  The time immediately before step 1 feels like the appropriate creation
> time for the worker. If we can get a hook into step 1 put into the Web
> Workers spec, I can link directly to that definition. I’ll file a bug on
> the editor.****
>
>  ****
>
> Jatinder****
>
>  ****
>
> *From:* James Robinson [mailto:jamesr@google.com]
> *Sent:* Tuesday, April 16, 2013 4:56 PM
> *To:* Jatinder Mann
> *Cc:* public-web-perf; James Simonsen****
>
>
> *Subject:* Re: [HighResTime] Web Worker support****
>
>  ****
>
> In the line:****
>
>  ****
>
> For a shared worker<http://www.w3.org/TR/workers/#shared-workers-and-the-sharedworkerglobalscope-interface>,
> the *time origin* must be equal to the time of creation of the shared
> worker.****
>
>  ****
>
> What is the definition of 'creation of the shared worker'?  I could
> imagine in the processing model:****
>
>  ****
>
>
> http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html#processing-model-6
> ****
>
>  ****
>
> that this could be interpreted as a time before or after steps 1, 4, 5, or
> just before step 8.  I think it needs a better normative reference,
> although the concept seems fine.****
>
>  ****
>
> - James****
>
>  ****
>
>  ****
>
> On Tue, Apr 16, 2013 at 4:43 PM, Jatinder Mann <jmann@microsoft.com>
> wrote:****
>
>  I have uploaded High Resolution Time Level 2 specification [1], which
> now supports performance.now() method in the Web Workers context. Please
> review the spec and provide feedback.****
>
>  ****
>
> Thanks,****
>
> Jatinder****
>
>  ****
>
> [1]
> https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/HighResolutionTime2/Overview.html
> ****
>
>  ****
>
> *From:* James Simonsen [mailto:simonjam@chromium.org]
> *Sent:* Wednesday, February 27, 2013 3:19 PM
> *To:* Jatinder Mann
> *Cc:* public-web-perf
> *Subject:* Re: [HighResTime] Web Worker support****
>
>  ****
>
> I was thinking just now() for the time being. I think the other stuff gets
> tricky when you have shared workers.****
>
>  ****
>
> I guess that means we need to define the 0 value too. I'd vote that it's
> the worker creation time.****
>
>  ****
>
> James****
>
>  ****
>
> On Wed, Feb 27, 2013 at 3:12 PM, Jatinder Mann <jmann@microsoft.com>
> wrote:****
>
>  I believe updating the spec to support now() in Web Workers isn’t hard.
> The real issue is whether we want to move the entire performance object,
> all the methods and attributes, or a subset of the performance object to
> Web Workers as well. ****
>
>  ****
>
> If we feel the Timing specs may not make sense in Web Workers, we’ll need
> to specifically exclude them. I think we should be able to make this change
> relatively quickly once we have consensus.****
>
>  ****
>
> Thanks,****
>
> Jatinder****
>
>  ****
>
> *From:* James Simonsen [mailto:simonjam@chromium.org]
> *Sent:* Wednesday, February 27, 2013 2:53 PM
> *To:* public-web-perf
> *Subject:* [HighResTime] Web Worker support****
>
>  ****
>
> Hi guys,****
>
>  ****
>
> Sorry to raise this again, but we keep getting bugged about it. How hard
> would it be to add Web Workers to High Res Time? The first edition is
> already a recommendation, so I think we'd need to create a level 2 spec for
> it.****
>
>
> Does anyone know how large of a change to the spec it'd be? Is it just a
> matter of adding one tag to the IDL? If so, it seems like we might be able
> to do it relatively quickly.****
>
>  ****
>
> Thanks,****
>
> James****
>
>   ****
>
>   ****
>
>  ** **
>

Received on Thursday, 18 April 2013 18:35:08 UTC