diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2025-05-23 14:42:05 +0200 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2025-05-23 14:42:05 +0200 |
commit | b1f82770b817d0558044d3cfb1ef4d36b4492055 (patch) | |
tree | 5d08ac0ace62954fd0662dfedc0f7bedbd0be5bc /RED/include/cyclecount.h | |
parent | 887aac6ff274e972e21ddab400502d76b78dfcbf (diff) |
RED: support → include; fix runtime for NR_DPUS==1
Diffstat (limited to 'RED/include/cyclecount.h')
-rw-r--r-- | RED/include/cyclecount.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/RED/include/cyclecount.h b/RED/include/cyclecount.h new file mode 100644 index 0000000..c4247b5 --- /dev/null +++ b/RED/include/cyclecount.h @@ -0,0 +1,19 @@ +#include <perfcounter.h> + +// Timer +typedef struct perfcounter_cycles{ + perfcounter_t start; + perfcounter_t end; + perfcounter_t end2; + +}perfcounter_cycles; + +void timer_start(perfcounter_cycles *cycles){ + cycles->start = perfcounter_get(); // START TIMER +} + +uint64_t timer_stop(perfcounter_cycles *cycles){ + cycles->end = perfcounter_get(); // STOP TIMER + cycles->end2 = perfcounter_get(); // STOP TIMER + return(((uint64_t)((uint32_t)(((cycles->end >> 4) - (cycles->start >> 4)) - ((cycles->end2 >> 4) - (cycles->end >> 4))))) << 4); +} |