[erlang-questions] System timers, now/0, and instrumentation

Mike Oxford moxford@REDACTED
Tue May 24 17:34:03 CEST 2011


I'm still a newbie, but you could write a port/BIF in C which calls into the
Windows high-resolution timers.  You'll lose a tiny bit but I'd think you'll
get better than 1ms resolutions.

-mox

On Tue, May 24, 2011 at 2:32 AM, Amy Lear <octopusfluff@REDACTED> wrote:

> On Tue, May 24, 2011 at 2:02 AM, Magnus Henoch <
> magnus.henoch@REDACTED> wrote:
>
>> ----- "Amy Lear" <octopusfluff@REDACTED> wrote:
>>
>> > The issue here as I understand it is that the system clock itself
>> > can't report things in the microsecond range (msdn states the
>> > granularity is between 10ms and 15ms:
>> >
>> http://msdn.microsoft.com/en-us/library/system.datetimeoffset.utcnow.aspx
>> > ), but the real values are being mangled to provide those guaranteed
>> > unique values. Given that now/0 is the obvious means of doing
>> > measurement for an erlang user -- and in fact the instrumentation
>> > tools that ship with erlang also appear to rely on it -- this results
>> > in puzzling and undesired behavior.
>>
>> Have you tried os:timestamp/0?  It's like now/0 but without the
>> uniqueness guarantee.  I'm not sure what granularity it has on
>> Windows, though.
>>
>> Hope this helps,
>>
>
> Unfortunately, it appears that the granularity of os:timestamp/0 is no
> finer than 1 ms, and the minimum resolution appears to be machine-dependant.
> Msdn research also suggests that the 1ms resolution timer is slower to
> access than the normal system clock, which could matter in some
> circumstances. Conversely, dropping the uniqueness facet and being higher
> resolution than now/0 does have some potential usefulness, but the erlang
> documentation indicates that the provided profiling tools rely on now/0.
>
> My question about instrumentation stands: is there currently a way to do
> high resolution profiling in Erlang on Windows? Is the requisite work of
> setting up sub-ms resolution timers simply not done/too much work to
> attempt?
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110524/9ff7eeb3/attachment.htm>


More information about the erlang-questions mailing list