From 3de4b495fb176eba9a0eb517a4ce05903cb67acb Mon Sep 17 00:00:00 2001 From: Juan Gomez Luna Date: Wed, 16 Jun 2021 19:46:05 +0200 Subject: PrIM -- first commit --- Microbenchmarks/STREAM/support/cyclecount.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Microbenchmarks/STREAM/support/cyclecount.h (limited to 'Microbenchmarks/STREAM/support/cyclecount.h') diff --git a/Microbenchmarks/STREAM/support/cyclecount.h b/Microbenchmarks/STREAM/support/cyclecount.h new file mode 100644 index 0000000..4ef377e --- /dev/null +++ b/Microbenchmarks/STREAM/support/cyclecount.h @@ -0,0 +1,20 @@ +#include + +// 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); +} + -- cgit v1.2.3