Timer¶
Header: libxs_timer.h
High-resolution timing via a calibrated TSC when available, with an OS real-time clock fallback.
Types¶
Integer type representing a single timer sample.
typedef struct libxs_timer_info_t {
int tsc; /* non-zero if a calibrated TSC is used */
} libxs_timer_info_t;
Functions¶
Query timer properties. info->tsc is non-zero when RDTSC (x86), CNTVCT_EL0 (AArch64), or MFTB (PPC64) is available. Triggers lazy library initialization if necessary.
Sample the current tick of the monotonic timer. The tick unit is platform-specific; convert with libxs_timer_duration or libxs_timer_ncycles.
libxs_timer_tick_t libxs_timer_ncycles(
libxs_timer_tick_t tick0, libxs_timer_tick_t tick1); /* inline */
Unsigned difference tick1 - tick0, handling wrap-around safely. Implemented via LIBXS_DELTA.
Convert a pair of ticks to elapsed wall-clock time in seconds.