testing: Added latency test for ck_cohort

ck_pring
Brendon Scheinman 12 years ago
parent 59cc30b671
commit 2cb79b0658

@ -0,0 +1,17 @@
.PHONY: all clean
OBJECTS=ck_cohort.THROUGHPUT ck_cohort.LATENCY
all: $(OBJECTS)
ck_cohort.THROUGHPUT: ck_cohort.c
$(CC) -DTHROUGHPUT $(CFLAGS) -o ck_cohort.THROUGHPUT ck_cohort.c
ck_cohort.LATENCY: ck_cohort.c
$(CC) -DLATENCY $(CFLAGS) -o ck_cohort.LATENCY ck_cohort.c
clean:
rm -rf *.dSYM $(OBJECTS)
include ../../../build/regressions.build
CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE -lm

@ -0,0 +1,8 @@
#include "../ck_cohort.h"
#include <ck_cohort.h>
#ifdef THROUGHPUT
#include "../../ck_spinlock/benchmark/throughput.h"
#elif defined(LATENCY)
#include "../../ck_spinlock/benchmark/latency.h"
#endif

@ -0,0 +1,10 @@
#define LOCK_NAME "ck_cohort"
#define LOCK_DEFINE\
typedef ck_spinlock_fas_t ck_spinlock_fas;\
static ck_spinlock_fas global_fas_lock = CK_SPINLOCK_FAS_INITIALIZER;\
static ck_spinlock_fas local_fas_lock = CK_SPINLOCK_FAS_INITIALIZER;\
CK_CREATE_COHORT(fas_fas, ck_spinlock_fas, ck_spinlock_fas)\
static struct ck_cohort_fas_fas CK_CC_CACHELINE cohort = CK_COHORT_INITIALIZER
#define LOCK_INIT ck_cohort_fas_fas_init(&cohort, &global_fas_lock, &local_fas_lock)
#define LOCK ck_cohort_fas_fas_lock(&cohort)
#define UNLOCK ck_cohort_fas_fas_unlock(&cohort)
Loading…
Cancel
Save