[erlang-questions] Fwd: erlang:trace/3 and cpu_timestamp
Mon Apr 28 14:27:51 CEST 2014
On Fri, Apr 25, 2014 at 12:35 PM, mats cronqvist <> wrote:
> man clock_gettime says;
> "The CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID clocks are
> realized on many platforms using timers from the CPUs (TSC on i386,
> AR.ITC on Itanium). These registers may differ between CPUs and as a
> consequence these clocks may return bogus results if a process is migrated
> to another CPU."
> Assuming that this is what you refer to, it seems wrong to disable
> cpu_timestamp on Linux. E.g., what if I run on a single-core machine? Or if
> my hardware is modern enough to support cross-core synchronized TSC?
That is indeed the feature that I'm talking about. The monotonic version of
it is what is used in the normal timestamp mechanism. And as you mention if
you do happen to run on a single core system you should be able to use the
timestamp without any issues.
> So, OTP has disabled cpu_timestamp on all Linux machines, because it
> might give bad data on some hardware/kernel combinations. I would be
> happier if I could decide myself if I want to trust the data or not.
Indeed, I can think of no reason why we would not allow people that know
their OS/hw gives monotonic cpu timestamps to use this. In fact if you
cross compile it is possible to do this already.
I'll see if I can find some time and have a look at what can be done to
help users use this functionality if they want it. I'll probably just to
add a configure switch that circumvents the check that you found. As always
if someone feels like making a patch for it that would be much appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions