kernel: add function to calculate delta between two cycle timestamps
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define CYCLES_MAX UINT64_MAX
|
||||
|
||||
typedef uintptr_t phys_addr_t;
|
||||
typedef uint64_t cycles_t;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user