aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanny Lin <danny@kdrag0n.dev>2019-08-20 14:29:22 -0700
committerDanny Lin <danny@kdrag0n.dev>2019-08-20 14:43:56 -0700
commit0769517adb9901f56933ba2e828c22d8364fbf50 (patch)
tree34da26d028bb3a3d5a03ee423a53b7cd4abd5a76
parent3d16b2322fbc2eb674a60e925d29a9a13d5240c7 (diff)
downloadschbench-0769517adb9901f56933ba2e828c22d8364fbf50.tar.gz
schbench: Add support for AArch64 CPUs
Instruction derived from the Linux kernel's cpu_relax() implementation for arm64. Signed-off-by: Danny Lin <danny@kdrag0n.dev>
-rw-r--r--schbench.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/schbench.c b/schbench.c
index d4586b6..64234c8 100644
--- a/schbench.c
+++ b/schbench.c
@@ -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;