Skip to content

Commit

Permalink
regressions/ck_epoch_section_2: Switch to heap allocated records.
Browse files Browse the repository at this point in the history
  • Loading branch information
sbahra committed Dec 30, 2015
1 parent 5999d8a commit f22f921
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions regressions/ck_epoch/validate/ck_epoch_section_2.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,12 @@ static struct affinity a;
static void *
read_thread(void *unused CK_CC_UNUSED)
{
ck_epoch_record_t record CK_CC_CACHELINE;
ck_epoch_record_t *record;
unsigned long long i = 0;

ck_epoch_register(&epoch, &record);
record = malloc(sizeof *record);
assert(record != NULL);
ck_epoch_register(&epoch, record);

if (aff_iterate(&a)) {
perror("ERROR: failed to affine thread");
Expand All @@ -77,15 +79,15 @@ read_thread(void *unused CK_CC_UNUSED)
ck_epoch_section_t junk[CK_EPOCH_T_DEPTH];
unsigned int j;

ck_epoch_begin(&record, &section[0]);
ck_epoch_begin(record, &section[0]);

for (j = 0; j < CK_EPOCH_T_DEPTH; j++)
ck_epoch_begin(&record, &junk[j]);
ck_epoch_begin(record, &junk[j]);
for (j = 0; j < CK_EPOCH_T_DEPTH; j++)
ck_epoch_end(&record, &junk[j]);
ck_epoch_end(record, &junk[j]);

if (i > 0)
ck_epoch_end(&record, &section[1]);
ck_epoch_end(record, &section[1]);

/* Wait for the next synchronize operation. */
while ((ck_pr_load_uint(&epoch.epoch) & 1) ==
Expand All @@ -95,23 +97,23 @@ read_thread(void *unused CK_CC_UNUSED)
if (!(i % 10000000)) {
fprintf(stderr, "%u %u %u\n",
ck_pr_load_uint(&epoch.epoch),
section[0].bucket, record.epoch);
section[0].bucket, record->epoch);
}

while ((ck_pr_load_uint(&epoch.epoch) & 1) ==
section[0].bucket)
ck_pr_stall();
}

ck_epoch_begin(&record, &section[1]);
ck_epoch_begin(record, &section[1]);

assert(section[0].bucket != section[1].bucket);
ck_epoch_end(&record, &section[0]);
ck_epoch_end(record, &section[0]);

assert(ck_pr_load_uint(&record.active) > 0);
assert(ck_pr_load_uint(&record->active) > 0);

if (ck_pr_load_uint(&leave) == 1) {
ck_epoch_end(&record, &section[1]);
ck_epoch_end(record, &section[1]);
break;
}

Expand Down

0 comments on commit f22f921

Please sign in to comment.