From b1f82770b817d0558044d3cfb1ef4d36b4492055 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 23 May 2025 14:42:05 +0200 Subject: RED: support → include; fix runtime for NR_DPUS==1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- RED/include/cyclecount.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 RED/include/cyclecount.h (limited to 'RED/include/cyclecount.h') 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 + +// 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