Skip to content

Commit

Permalink
schbench: Add support for AArch64 CPUs
Browse files Browse the repository at this point in the history
Instruction derived from the Linux kernel's cpu_relax() implementation
for arm64.

Signed-off-by: Danny Lin <[email protected]>
  • Loading branch information
kdrag0n committed Aug 20, 2019
1 parent 3d16b23 commit 0769517
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions schbench.c
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,14 @@ static void run_rps_thread(struct thread_data *worker_threads_mem)
}
}

#if defined(__x86_64__) || defined(__i386__)
#define nop __asm__ __volatile__("rep;nop": : :"memory")
#elif defined(__aarch64__)
#define nop __asm__ __volatile__("yield" ::: "memory")
#else
#error Unsupported architecture
#endif

static void usec_spin(unsigned long spin_time)
{
struct timeval now;
Expand Down

0 comments on commit 0769517

Please sign in to comment.