From e36b37583bebd229102f46c4ed7d2f6fad8697d4 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 23 Jul 2021 13:24:09 +0200 Subject: Adding upstream version 0.6.0. Signed-off-by: Daniel Baumann --- regressions/ck_pr/benchmark/fp.c | 66 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 regressions/ck_pr/benchmark/fp.c (limited to 'regressions/ck_pr/benchmark/fp.c') diff --git a/regressions/ck_pr/benchmark/fp.c b/regressions/ck_pr/benchmark/fp.c new file mode 100644 index 0000000..f7aa157 --- /dev/null +++ b/regressions/ck_pr/benchmark/fp.c @@ -0,0 +1,66 @@ +#include +#include +#include + +#include "../../common.h" + +#ifndef IR +#define IR 3000000 +#endif /* IR */ + +static int a CK_CC_CACHELINE; +static int b CK_CC_CACHELINE; + +int +main(void) +{ + uint64_t s, e; + unsigned int i; + + s = rdtsc(); + for (i = 0; i < IR; i++) { + ck_pr_load_int(&a); + ck_pr_fence_strict_load(); + ck_pr_load_int(&b); + } + e = rdtsc(); + printf("[A] fence_load: %" PRIu64 "\n", (e - s) / IR); + + s = rdtsc(); + for (i = 0; i < IR; i++) { + if (ck_pr_load_int(&a) == 0) + ck_pr_barrier(); + ck_pr_fence_strict_lock(); + ck_pr_load_int(&b); + } + e = rdtsc(); + printf("[A] fence_lock: %" PRIu64 "\n", (e - s) / IR); + + s = rdtsc(); + for (i = 0; i < IR; i++) { + ck_pr_store_int(&a, 0); + ck_pr_fence_strict_store(); + ck_pr_store_int(&b, 0); + } + e = rdtsc(); + printf("[B] fence_store: %" PRIu64 "\n", (e - s) / IR); + + s = rdtsc(); + for (i = 0; i < IR; i++) { + ck_pr_store_int(&a, 0); + ck_pr_fence_strict_memory(); + ck_pr_load_int(&b); + } + e = rdtsc(); + printf("[C] fence_memory: %" PRIu64 "\n", (e - s) / IR); + + s = rdtsc(); + for (i = 0; i < IR; i++) { + ck_pr_store_int(&a, 0); + ck_pr_faa_int(&a, 0); + ck_pr_load_int(&b); + } + e = rdtsc(); + printf("[C] atomic: %" PRIu64 "\n", (e - s) / IR); + return 0; +} -- cgit v1.2.3