CAMLprim value caml_cycle_counter (value unit) { #if defined (__x86__) return Val_long (__rdtsc ()); #elif defined (__arm__) return Val_long (read_virtual_count ()); #else #error ("No known cycle-counting instruction.") #endif }
/* monotonic_clock(): returns # of nanoseconds passed since time_init() * Note: This function is required to return accurate * time even in the absence of multiple timer ticks. */ uint64_t monotonic_clock(void) { return ticks_to_ns(read_virtual_count() - cntvct_at_init); }