regressions/epoch/torture: include synchronize latency.

ck_pring
Samy Al Bahra 8 years ago
parent f8d5022030
commit 77fc933229

@ -31,8 +31,8 @@
#include <unistd.h> #include <unistd.h>
#include <ck_cc.h> #include <ck_cc.h>
#include <ck_pr.h> #include <ck_pr.h>
#include <inttypes.h>
#include <stdbool.h> #include <stdbool.h>
#include <stddef.h>
#include <string.h> #include <string.h>
#include <ck_epoch.h> #include <ck_epoch.h>
#include <ck_stack.h> #include <ck_stack.h>
@ -147,6 +147,7 @@ write_thread(void *unused CK_CC_UNUSED)
ck_epoch_record_t *record; ck_epoch_record_t *record;
unsigned long iterations = 0; unsigned long iterations = 0;
bool c = ck_pr_faa_uint(&first, 1); bool c = ck_pr_faa_uint(&first, 1);
uint64_t ac = 0;
record = malloc(sizeof *record); record = malloc(sizeof *record);
assert(record != NULL); assert(record != NULL);
@ -160,6 +161,12 @@ write_thread(void *unused CK_CC_UNUSED)
ck_pr_inc_uint(&barrier); ck_pr_inc_uint(&barrier);
while (ck_pr_load_uint(&barrier) < n_threads); while (ck_pr_load_uint(&barrier) < n_threads);
#define CK_EPOCH_S do { \
uint64_t _s = rdtsc(); \
ck_epoch_synchronize(record); \
ac += rdtsc() - _s; \
} while (0)
do { do {
/* /*
* A thread should never observe invalid.value > valid.value. * A thread should never observe invalid.value > valid.value.
@ -167,33 +174,34 @@ write_thread(void *unused CK_CC_UNUSED)
* invalid.value <= valid.value is valid. * invalid.value <= valid.value is valid.
*/ */
if (!c) ck_pr_store_uint(&valid.value, 1); if (!c) ck_pr_store_uint(&valid.value, 1);
ck_epoch_synchronize(record); CK_EPOCH_S;
if (!c) ck_pr_store_uint(&invalid.value, 1); if (!c) ck_pr_store_uint(&invalid.value, 1);
ck_pr_fence_store(); ck_pr_fence_store();
if (!c) ck_pr_store_uint(&valid.value, 2); if (!c) ck_pr_store_uint(&valid.value, 2);
ck_epoch_synchronize(record); CK_EPOCH_S;
if (!c) ck_pr_store_uint(&invalid.value, 2); if (!c) ck_pr_store_uint(&invalid.value, 2);
ck_pr_fence_store(); ck_pr_fence_store();
if (!c) ck_pr_store_uint(&valid.value, 3); if (!c) ck_pr_store_uint(&valid.value, 3);
ck_epoch_synchronize(record); CK_EPOCH_S;
if (!c) ck_pr_store_uint(&invalid.value, 3); if (!c) ck_pr_store_uint(&invalid.value, 3);
ck_pr_fence_store(); ck_pr_fence_store();
if (!c) ck_pr_store_uint(&valid.value, 4); if (!c) ck_pr_store_uint(&valid.value, 4);
ck_epoch_synchronize(record); CK_EPOCH_S;
if (!c) ck_pr_store_uint(&invalid.value, 4); if (!c) ck_pr_store_uint(&invalid.value, 4);
ck_epoch_synchronize(record); CK_EPOCH_S;
if (!c) ck_pr_store_uint(&invalid.value, 0); if (!c) ck_pr_store_uint(&invalid.value, 0);
ck_epoch_synchronize(record); CK_EPOCH_S;
iterations += 4; iterations += 6;
} while (ck_pr_load_uint(&leave) == 0 && } while (ck_pr_load_uint(&leave) == 0 &&
ck_pr_load_uint(&n_rd) > 0); ck_pr_load_uint(&n_rd) > 0);
fprintf(stderr, "%lu iterations\n", iterations); fprintf(stderr, "%lu iterations\n", iterations);
fprintf(stderr, "%" PRIu64 " average latency\n", ac / iterations);
return NULL; return NULL;
} }

Loading…
Cancel
Save