Skip to content
  • Philippe Gerum's avatar
    lib/cobalt: export service for reading the high resolution clock · d584a57d
    Philippe Gerum authored
    cobalt_read_hrclock() returns the current TSC value as defined by the
    platform. This is a Cobalt-specific service, which is aimed at
    measuring elapsed time accurately, with low overhead. The output is
    the current raw count of ticks, as reported by the hrclock device used
    by Cobalt for timing.
    
    Such value is NOT converted to nanoseconds before return.
    cobalt_ticks_to_ns() and cobalt_ticks_to_ns_rounded() are available
    for converting raw tick counts to nanoseconds.
    
    Application code should stick with clock_gettime(CLOCK_MONOTONIC, ...)
    for portability.
    
    This clock source is guaranteed continuous, monotonically increasing.
    d584a57d