File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,13 +20,16 @@ struct bench *b;
2020
2121static inline uint64_t read_cycle_count ()
2222{
23- uint64_t cycle_count ;
23+ uint64_t cycle_count = 0 ;
2424#if defined(CONFIG_ARCH_ARM )
2525 SEL4BENCH_READ_CCNT (cycle_count );
2626#elif defined(CONFIG_ARCH_RISCV )
2727 asm volatile ("rdcycle %0" : "=r" (cycle_count ));
2828#elif defined(CONFIG_ARCH_X86_64 )
29- // Do nothing only for build atm
29+ uint32_t lo , hi , unused ;
30+ __asm__ __volatile__("rdtscp" : "=a" (lo ), "=d" (hi ), "=c" (unused ));
31+ __asm__ __volatile__("lfence" ::: "memory" );
32+ cycle_count = ((uint64_t )hi << 32 ) | lo ;
3033#else
3134#error "read_cycle_count: unsupported architecture"
3235#endif
Original file line number Diff line number Diff line change 1515 * on non-benchmarking configurations.
1616 * This defines whether we actually try to benchmark, setup the PMU etc.
1717 */
18- #if defined(CONFIG_ENABLE_BENCHMARKS ) && (defined(CONFIG_ARCH_ARM ) || defined(CONFIG_ARCH_RISCV ))
18+ #if defined(CONFIG_ENABLE_BENCHMARKS ) && (defined(CONFIG_ARCH_ARM ) || defined(CONFIG_ARCH_RISCV ) || defined( CONFIG_ARCH_X86_64 ) )
1919#define ENABLE_BENCHMARKING 1
2020#else
2121#define ENABLE_BENCHMARKING 0
You can’t perform that action at this time.
0 commit comments