diff --git a/include/socks/cpu.h b/include/socks/cpu.h index e676a97..419aad5 100644 --- a/include/socks/cpu.h +++ b/include/socks/cpu.h @@ -36,6 +36,10 @@ extern void cpu_set_available(unsigned int cpu_id); extern void cpu_set_online(unsigned int cpu_id); extern cycles_t get_cycles(void); +static inline cycles_t cycles_diff(cycles_t then, cycles_t now) +{ + return now >= then ? now - then : (CYCLES_MAX - then) + now; +} #define irq_enable() ml_int_enable() #define irq_disable() ml_int_disable() diff --git a/include/socks/types.h b/include/socks/types.h index c3ec830..96dcf57 100644 --- a/include/socks/types.h +++ b/include/socks/types.h @@ -3,6 +3,8 @@ #include +#define CYCLES_MAX UINT64_MAX + typedef uintptr_t phys_addr_t; typedef uint64_t cycles_t;