From 3fefa3b5a3c5d727ce38e1fcb973b67fc8dd8b9b Mon Sep 17 00:00:00 2001 From: Brendon Scheinman Date: Sat, 9 Mar 2013 22:10:52 -0600 Subject: [PATCH] ck_cohort: Fixed regression tests based on ck_cohort_rw changes --- regressions/ck_cohort/benchmark/throughput.c | 20 ++++++--- regressions/ck_cohort/ck_cohort.h | 45 ++++++++++++-------- regressions/ck_cohort/validate/validate.c | 13 +++++- 3 files changed, 52 insertions(+), 26 deletions(-) diff --git a/regressions/ck_cohort/benchmark/throughput.c b/regressions/ck_cohort/benchmark/throughput.c index 9242408..f94be74 100644 --- a/regressions/ck_cohort/benchmark/throughput.c +++ b/regressions/ck_cohort/benchmark/throughput.c @@ -60,26 +60,34 @@ static unsigned int barrier; static int critical CK_CC_CACHELINE; static void -ck_spinlock_lock_with_context(ck_spinlock_t *lock, void *context) +ck_spinlock_fas_lock_with_context(ck_spinlock_fas_t *lock, void *context) { (void)context; - ck_spinlock_lock(lock); + ck_spinlock_fas_lock(lock); return; } static void -ck_spinlock_unlock_with_context(ck_spinlock_t *lock, void *context) +ck_spinlock_fas_unlock_with_context(ck_spinlock_fas_t *lock, void *context) { (void)context; - ck_spinlock_unlock(lock); + ck_spinlock_fas_unlock(lock); return; } +static bool +ck_spinlock_fas_locked_with_context(ck_spinlock_fas_t *lock, void *context) +{ + + (void)context; + return ck_spinlock_fas_locked(lock); +} + CK_COHORT_PROTOTYPE(basic, - ck_spinlock_lock_with_context, ck_spinlock_unlock_with_context, - ck_spinlock_lock_with_context, ck_spinlock_unlock_with_context) + ck_spinlock_fas_lock_with_context, ck_spinlock_fas_unlock_with_context, ck_spinlock_fas_locked_with_context, + ck_spinlock_fas_lock_with_context, ck_spinlock_fas_unlock_with_context, ck_spinlock_fas_locked_with_context) struct cohort_record { CK_COHORT_INSTANCE(basic) cohort; diff --git a/regressions/ck_cohort/ck_cohort.h b/regressions/ck_cohort/ck_cohort.h index 847544c..8427d6b 100644 --- a/regressions/ck_cohort/ck_cohort.h +++ b/regressions/ck_cohort/ck_cohort.h @@ -1,24 +1,33 @@ #define LOCK_NAME "ck_cohort" #define LOCK_DEFINE\ - static ck_spinlock_fas_t global_fas_lock = CK_SPINLOCK_FAS_INITIALIZER;\ - static ck_spinlock_fas_t local_fas_lock = CK_SPINLOCK_FAS_INITIALIZER;\ - static void\ - ck_spinlock_fas_lock_with_context(ck_spinlock_fas_t *lock, void *context)\ - {\ - (void)context;\ - ck_spinlock_fas_lock(lock);\ - }\ -\ - static void\ - ck_spinlock_fas_unlock_with_context(ck_spinlock_fas_t *lock, void *context)\ - {\ - (void)context;\ - ck_spinlock_fas_unlock(lock);\ - }\ - CK_COHORT_PROTOTYPE(fas_fas,\ - ck_spinlock_fas_lock_with_context, ck_spinlock_fas_unlock_with_context,\ - ck_spinlock_fas_lock_with_context, ck_spinlock_fas_unlock_with_context)\ + static ck_spinlock_fas_t global_fas_lock = CK_SPINLOCK_FAS_INITIALIZER; \ + static ck_spinlock_fas_t local_fas_lock = CK_SPINLOCK_FAS_INITIALIZER; \ + static void \ + ck_spinlock_fas_lock_with_context(ck_spinlock_fas_t *lock, void *context) \ + { \ + (void)context; \ + ck_spinlock_fas_lock(lock); \ + } \ + \ + static void \ + ck_spinlock_fas_unlock_with_context(ck_spinlock_fas_t *lock, void *context) \ + { \ + (void)context; \ + ck_spinlock_fas_unlock(lock); \ + } \ + \ + static bool \ + ck_spinlock_fas_locked_with_context(ck_spinlock_fas_t *lock, void *context) \ + { \ + (void)context; \ + return ck_spinlock_fas_locked(lock); \ + } \ + CK_COHORT_PROTOTYPE(fas_fas, \ + ck_spinlock_fas_lock_with_context, ck_spinlock_fas_unlock_with_context, \ + ck_spinlock_fas_locked_with_context, ck_spinlock_fas_lock_with_context, \ + ck_spinlock_fas_unlock_with_context, ck_spinlock_fas_locked_with_context) \ static CK_COHORT_INSTANCE(fas_fas) CK_CC_CACHELINE cohort = CK_COHORT_INITIALIZER + #define LOCK_INIT CK_COHORT_INIT(fas_fas, &cohort, &global_fas_lock, &local_fas_lock,\ CK_COHORT_DEFAULT_LOCAL_PASS_LIMIT) #define LOCK CK_COHORT_LOCK(fas_fas, &cohort, NULL, NULL) diff --git a/regressions/ck_cohort/validate/validate.c b/regressions/ck_cohort/validate/validate.c index de6d914..df1ac6c 100644 --- a/regressions/ck_cohort/validate/validate.c +++ b/regressions/ck_cohort/validate/validate.c @@ -59,6 +59,13 @@ ck_spinlock_fas_unlock_with_context(ck_spinlock_fas_t *lock, void *context) ck_spinlock_fas_unlock(lock); } +static bool +ck_spinlock_fas_locked_with_context(ck_spinlock_fas_t *lock, void *context) +{ + (void)context; + return ck_spinlock_fas_locked(lock); +} + static bool ck_spinlock_fas_trylock_with_context(ck_spinlock_fas_t *lock, void *context) { @@ -67,8 +74,10 @@ ck_spinlock_fas_trylock_with_context(ck_spinlock_fas_t *lock, void *context) } CK_COHORT_TRYLOCK_PROTOTYPE(fas_fas, - ck_spinlock_fas_lock_with_context, ck_spinlock_fas_unlock_with_context, ck_spinlock_fas_trylock_with_context, - ck_spinlock_fas_lock_with_context, ck_spinlock_fas_unlock_with_context, ck_spinlock_fas_trylock_with_context) + ck_spinlock_fas_lock_with_context, ck_spinlock_fas_unlock_with_context, + ck_spinlock_fas_locked_with_context, ck_spinlock_fas_trylock_with_context, + ck_spinlock_fas_lock_with_context, ck_spinlock_fas_unlock_with_context, + ck_spinlock_fas_locked_with_context, ck_spinlock_fas_trylock_with_context) static CK_COHORT_INSTANCE(fas_fas) *cohorts; static int n_cohorts;