diff options
Diffstat (limited to 'RED/support/cyclecount.h')
-rw-r--r-- | RED/support/cyclecount.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/RED/support/cyclecount.h b/RED/support/cyclecount.h new file mode 100644 index 0000000..c4247b5 --- /dev/null +++ b/RED/support/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); +} |