|
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.
|