This is far from comprehensive but needed for some upcoming tests.ck_pring
parent
e693cb9afe
commit
b46703ec5c
@ -0,0 +1,56 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <inttypes.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#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("fence_load: %" 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_load_int(&b);
|
||||||
|
}
|
||||||
|
e = rdtsc();
|
||||||
|
printf("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("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("atomic: %" PRIu64 "\n", (e - s) / IR);
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in new issue