[erlang-questions] Time Granularity on Windows

Lukas Larsson <>
Fri Jan 29 15:37:59 CET 2016


The problem with QPC is that it is not monotonic. From
https://msdn.microsoft.com/en-us/library/dn553408.aspx.

"Can the performance counter be used to order events in time?
Yes. However, when comparing performance counter results that are acquired
from different threads, values that differ by ± 1 tick have an ambiguous
ordering as if they had an identical time stamp."

If it wasn't for that small caveat we would have used it.

Lukas

On Fri, Jan 29, 2016 at 2:32 PM, Rob A'Court <> wrote:

> Ok, fine. Thank you!
>
>
>
> We’ve done a bit more research and it looks like it is possible to get better granularity on Windows, but only by making a windows kernel call:
>
> http://erlang.org/pipermail/erlang-questions/2011-May/058940.html
>
>
>
>
>
> *From:* Lukas Larsson [mailto:]
> *Sent:* 29 January 2016 10:33
> *To:* Rob A'Court <>
> *Cc:* 
> *Subject:* Re: [erlang-questions] Time Granularity on Windows
>
>
>
> Hello,
>
>
>
> On Fri, Jan 29, 2016 at 11:17 AM, Rob A'Court <> wrote:
>
>
>
> Is this a problem with something I am doing or with the granularity of the
> windows system clock?
>
>
>
> It is a problem with the granularity of the monotonic time source on
> Windows.
>
>
>
>
>
> Is there another approach I could take to get accurate (~microsecond
> granularity) timestamps on windows and linux?
>
>
>
>
>
> Maybe try os:timestamp on windows? I can't remember what it falls back
> onto, but as it does not have any monoticity guarantees it may give better
> values.
>
>
>
> Lukas
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160129/83a174cc/attachment.html>


More information about the erlang-questions mailing list