[erlang-patches] [PATCH] robustify hipe_bifs:get_hrvtime/0

Björn Gustavsson bgustavsson@REDACTED
Fri Aug 27 12:00:49 CEST 2010


On Thu, Aug 26, 2010 at 12:25 AM, Mikael Pettersson <mikpe@REDACTED> wrote:
> The HiPE runtime system has a hipe_bifs:get_hrvtime/0 BIF which
> mimics the non-standard gethrvtime() C API.  It's possible to
> configure the implementation to use the "perfctr" Linux kernel
> extension for performance-monitoring counters, in which case
> get_hrvtime has very high precision and low overhead.  Otherwise
> it uses the same code as runtime(statistics).
>
> This patch changes the get_hrvtime implementation to do a runtime
> check to see if perfctr is available, and to use the fallback code
> rather than returning a dummy value if perfctr is unavailable,
> which is common.
>
> The current dummy value return is a bug.  It messes up the API
> and either breaks callers (they get badarg when trying to compute
> on the value) or forces them to implement checks and fallbacks
> themselves.  Timing code in HiPE's test suites and benchmarks
> is known to be affected.
>
Thanks! Will include in pu.

-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB


More information about the erlang-patches mailing list