You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by so...@apache.org on 2015/06/14 00:55:54 UTC
[04/22] trafficserver git commit: TS-3689: Remove libck
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/benchmark/Makefile
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/benchmark/Makefile b/lib/ck/regressions/ck_spinlock/benchmark/Makefile
deleted file mode 100644
index ca3e1cf..0000000
--- a/lib/ck/regressions/ck_spinlock/benchmark/Makefile
+++ /dev/null
@@ -1,87 +0,0 @@
-.PHONY: all clean
-
-OBJECTS=ck_ticket.THROUGHPUT ck_ticket.LATENCY \
- ck_mcs.THROUGHPUT ck_mcs.LATENCY \
- ck_dec.THROUGHPUT ck_dec.LATENCY \
- ck_cas.THROUGHPUT ck_cas.LATENCY \
- ck_fas.THROUGHPUT ck_fas.LATENCY \
- ck_clh.THROUGHPUT ck_clh.LATENCY \
- linux_spinlock.THROUGHPUT linux_spinlock.LATENCY \
- ck_ticket_pb.THROUGHPUT ck_ticket_pb.LATENCY \
- ck_anderson.THROUGHPUT ck_anderson.LATENCY \
- ck_spinlock.THROUGHPUT ck_spinlock.LATENCY \
- ck_hclh.THROUGHPUT ck_hclh.LATENCY
-
-all: $(OBJECTS)
-
-ck_spinlock.THROUGHPUT: ck_spinlock.c
- $(CC) -DTHROUGHPUT $(CFLAGS) -o ck_spinlock.THROUGHPUT ck_spinlock.c -lm
-
-ck_spinlock.LATENCY: ck_spinlock.c
- $(CC) -DLATENCY $(CFLAGS) -o ck_spinlock.LATENCY ck_spinlock.c -lm
-
-ck_ticket.THROUGHPUT: ck_ticket.c
- $(CC) -DTHROUGHPUT $(CFLAGS) -o ck_ticket.THROUGHPUT ck_ticket.c -lm
-
-ck_ticket.LATENCY: ck_ticket.c
- $(CC) -DLATENCY $(CFLAGS) -o ck_ticket.LATENCY ck_ticket.c -lm
-
-ck_mcs.THROUGHPUT: ck_mcs.c
- $(CC) -DTHROUGHPUT $(CFLAGS) -o ck_mcs.THROUGHPUT ck_mcs.c -lm
-
-ck_mcs.LATENCY: ck_mcs.c
- $(CC) -DLATENCY $(CFLAGS) -o ck_mcs.LATENCY ck_mcs.c -lm
-
-ck_dec.THROUGHPUT: ck_dec.c
- $(CC) -DTHROUGHPUT $(CFLAGS) -o ck_dec.THROUGHPUT ck_dec.c -lm
-
-ck_dec.LATENCY: ck_dec.c
- $(CC) -DLATENCY $(CFLAGS) -o ck_dec.LATENCY ck_dec.c -lm
-
-ck_cas.THROUGHPUT: ck_cas.c
- $(CC) -DTHROUGHPUT $(CFLAGS) -o ck_cas.THROUGHPUT ck_cas.c -lm
-
-ck_cas.LATENCY: ck_cas.c
- $(CC) -DLATENCY $(CFLAGS) -o ck_cas.LATENCY ck_cas.c -lm
-
-ck_fas.THROUGHPUT: ck_fas.c
- $(CC) -DTHROUGHPUT $(CFLAGS) -o ck_fas.THROUGHPUT ck_fas.c -lm
-
-ck_fas.LATENCY: ck_fas.c
- $(CC) -DLATENCY $(CFLAGS) -o ck_fas.LATENCY ck_fas.c -lm
-
-ck_clh.THROUGHPUT: ck_clh.c
- $(CC) -DTHROUGHPUT $(CFLAGS) -o ck_clh.THROUGHPUT ck_clh.c -lm
-
-ck_clh.LATENCY: ck_clh.c
- $(CC) -DLATENCY $(CFLAGS) -o ck_clh.LATENCY ck_clh.c -lm
-
-ck_hclh.THROUGHPUT: ck_hclh.c
- $(CC) -DTHROUGHPUT $(CFLAGS) -o ck_hclh.THROUGHPUT ck_hclh.c -lm
-
-ck_hclh.LATENCY: ck_hclh.c
- $(CC) -DLATENCY $(CFLAGS) -o ck_hclh.LATENCY ck_hclh.c -lm
-
-linux_spinlock.THROUGHPUT: linux_spinlock.c
- $(CC) -DTHROUGHPUT $(CFLAGS) -o linux_spinlock.THROUGHPUT linux_spinlock.c -lm
-
-linux_spinlock.LATENCY: linux_spinlock.c
- $(CC) -DLATENCY $(CFLAGS) -o linux_spinlock.LATENCY linux_spinlock.c -lm
-
-ck_ticket_pb.THROUGHPUT: ck_ticket_pb.c
- $(CC) -DTHROUGHPUT $(CFLAGS) -o ck_ticket_pb.THROUGHPUT ck_ticket_pb.c -lm
-
-ck_ticket_pb.LATENCY: ck_ticket_pb.c
- $(CC) -DLATENCY $(CFLAGS) -o ck_ticket_pb.LATENCY ck_ticket_pb.c -lm
-
-ck_anderson.THROUGHPUT: ck_anderson.c
- $(CC) -DTHROUGHPUT $(CFLAGS) -o ck_anderson.THROUGHPUT ck_anderson.c -lm
-
-ck_anderson.LATENCY: ck_anderson.c
- $(CC) -DLATENCY $(CFLAGS) -o ck_anderson.LATENCY ck_anderson.c -lm
-
-clean:
- rm -rf *.dSYM *.exe $(OBJECTS)
-
-include ../../../build/regressions.build
-CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/benchmark/ck_anderson.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/benchmark/ck_anderson.c b/lib/ck/regressions/ck_spinlock/benchmark/ck_anderson.c
deleted file mode 100644
index 2f1aecd..0000000
--- a/lib/ck/regressions/ck_spinlock/benchmark/ck_anderson.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "../ck_anderson.h"
-
-#ifdef THROUGHPUT
-#include "throughput.h"
-#elif defined(LATENCY)
-#include "latency.h"
-#endif
-
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/benchmark/ck_cas.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/benchmark/ck_cas.c b/lib/ck/regressions/ck_spinlock/benchmark/ck_cas.c
deleted file mode 100644
index 96bd9d8..0000000
--- a/lib/ck/regressions/ck_spinlock/benchmark/ck_cas.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "../ck_cas.h"
-
-#ifdef THROUGHPUT
-#include "throughput.h"
-#elif defined(LATENCY)
-#include "latency.h"
-#endif
-
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/benchmark/ck_clh.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/benchmark/ck_clh.c b/lib/ck/regressions/ck_spinlock/benchmark/ck_clh.c
deleted file mode 100644
index da71d5e..0000000
--- a/lib/ck/regressions/ck_spinlock/benchmark/ck_clh.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "../ck_clh.h"
-
-#ifdef THROUGHPUT
-#include "throughput.h"
-#elif defined(LATENCY)
-#include "latency.h"
-#endif
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/benchmark/ck_dec.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/benchmark/ck_dec.c b/lib/ck/regressions/ck_spinlock/benchmark/ck_dec.c
deleted file mode 100644
index 115c116..0000000
--- a/lib/ck/regressions/ck_spinlock/benchmark/ck_dec.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "../ck_dec.h"
-
-#ifdef THROUGHPUT
-#include "throughput.h"
-#elif defined(LATENCY)
-#include "latency.h"
-#endif
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/benchmark/ck_fas.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/benchmark/ck_fas.c b/lib/ck/regressions/ck_spinlock/benchmark/ck_fas.c
deleted file mode 100644
index c76c964..0000000
--- a/lib/ck/regressions/ck_spinlock/benchmark/ck_fas.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "../ck_fas.h"
-
-#ifdef THROUGHPUT
-#include "throughput.h"
-#elif defined(LATENCY)
-#include "latency.h"
-#endif
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/benchmark/ck_hclh.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/benchmark/ck_hclh.c b/lib/ck/regressions/ck_spinlock/benchmark/ck_hclh.c
deleted file mode 100644
index 9ae443e..0000000
--- a/lib/ck/regressions/ck_spinlock/benchmark/ck_hclh.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "../ck_hclh.h"
-
-#ifdef THROUGHPUT
-#include "throughput.h"
-#elif defined(LATENCY)
-#include "latency.h"
-#endif
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/benchmark/ck_mcs.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/benchmark/ck_mcs.c b/lib/ck/regressions/ck_spinlock/benchmark/ck_mcs.c
deleted file mode 100644
index c2e95de..0000000
--- a/lib/ck/regressions/ck_spinlock/benchmark/ck_mcs.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "../ck_mcs.h"
-
-#ifdef THROUGHPUT
-#include "throughput.h"
-#elif defined(LATENCY)
-#include "latency.h"
-#endif
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/benchmark/ck_spinlock.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/benchmark/ck_spinlock.c b/lib/ck/regressions/ck_spinlock/benchmark/ck_spinlock.c
deleted file mode 100644
index 138541e..0000000
--- a/lib/ck/regressions/ck_spinlock/benchmark/ck_spinlock.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "../ck_spinlock.h"
-
-#ifdef THROUGHPUT
-#include "throughput.h"
-#elif defined(LATENCY)
-#include "latency.h"
-#endif
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/benchmark/ck_ticket.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/benchmark/ck_ticket.c b/lib/ck/regressions/ck_spinlock/benchmark/ck_ticket.c
deleted file mode 100644
index 09c9193..0000000
--- a/lib/ck/regressions/ck_spinlock/benchmark/ck_ticket.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "../ck_ticket.h"
-
-#ifdef THROUGHPUT
-#include "throughput.h"
-#elif defined(LATENCY)
-#include "latency.h"
-#endif
-
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/benchmark/ck_ticket_pb.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/benchmark/ck_ticket_pb.c b/lib/ck/regressions/ck_spinlock/benchmark/ck_ticket_pb.c
deleted file mode 100644
index 6122d6a..0000000
--- a/lib/ck/regressions/ck_spinlock/benchmark/ck_ticket_pb.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "../ck_ticket_pb.h"
-
-#ifdef THROUGHPUT
-#include "throughput.h"
-#elif defined(LATENCY)
-#include "latency.h"
-#endif
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/benchmark/latency.h
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/benchmark/latency.h b/lib/ck/regressions/ck_spinlock/benchmark/latency.h
deleted file mode 100644
index 51cc6cc..0000000
--- a/lib/ck/regressions/ck_spinlock/benchmark/latency.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2011-2014 Samy Al Bahra.
- * Copyright 2011 David Joseph.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <ck_bytelock.h>
-#include <ck_spinlock.h>
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "../../common.h"
-
-#ifndef STEPS
-#define STEPS 30000000
-#endif
-
-LOCK_DEFINE;
-
-int
-main(void)
-{
- CK_CC_UNUSED unsigned int nthr = 1;
-
- #ifdef LOCK_INIT
- LOCK_INIT;
- #endif
-
- #ifdef LOCK_STATE
- LOCK_STATE;
- #endif
-
- uint64_t s_b, e_b, i;
- CK_CC_UNUSED int core = 0;
-
- s_b = rdtsc();
- for (i = 0; i < STEPS; ++i) {
- #ifdef LOCK
- LOCK;
- UNLOCK;
- LOCK;
- UNLOCK;
- LOCK;
- UNLOCK;
- LOCK;
- UNLOCK;
- #endif
- }
- e_b = rdtsc();
- printf("%15" PRIu64 "\n", (e_b - s_b) / 4 / STEPS);
-
- return (0);
-}
-
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/benchmark/linux_spinlock.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/benchmark/linux_spinlock.c b/lib/ck/regressions/ck_spinlock/benchmark/linux_spinlock.c
deleted file mode 100644
index 954019b..0000000
--- a/lib/ck/regressions/ck_spinlock/benchmark/linux_spinlock.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "../linux_spinlock.h"
-
-#ifdef THROUGHPUT
-#include "throughput.h"
-#elif defined(LATENCY)
-#include "latency.h"
-#endif
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/benchmark/throughput.h
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/benchmark/throughput.h b/lib/ck/regressions/ck_spinlock/benchmark/throughput.h
deleted file mode 100644
index 7851c50..0000000
--- a/lib/ck/regressions/ck_spinlock/benchmark/throughput.h
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * Copyright 2008-2012 Samy Al Bahra.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <inttypes.h>
-#include <pthread.h>
-#include <math.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <strings.h>
-#include <unistd.h>
-#include <sys/time.h>
-
-#include <ck_pr.h>
-#include <ck_spinlock.h>
-
-#include "../../common.h"
-
-/* 8! = 40320, evenly divide 1 .. 8 processor workload. */
-#define WORKLOAD (40320 * 2056)
-
-#ifndef ITERATE
-#define ITERATE 65536
-#endif
-
-struct block {
- unsigned int tid;
-};
-
-static struct affinity a;
-static unsigned int ready;
-
-struct counters {
- uint64_t value;
-} CK_CC_CACHELINE;
-
-static struct counters *count;
-static uint64_t nthr;
-static unsigned int barrier;
-
-int critical __attribute__((aligned(64)));
-
-LOCK_DEFINE;
-
-CK_CC_USED static void
-gen_lock(void)
-{
- CK_CC_UNUSED int core = 0;
-#ifdef LOCK_STATE
- LOCK_STATE;
-#endif
-
-#ifdef LOCK
- LOCK;
-#endif
-}
-
-CK_CC_USED static void
-gen_unlock(void)
-{
-#ifdef LOCK_STATE
- LOCK_STATE;
-#endif
-
-#ifdef UNLOCK
- UNLOCK;
-#endif
-}
-
-static void *
-fairness(void *null)
-{
-#ifdef LOCK_STATE
- LOCK_STATE;
-#endif
- struct block *context = null;
- unsigned int i = context->tid;
- volatile int j;
- long int base;
- unsigned int core;
-
- if (aff_iterate_core(&a, &core)) {
- perror("ERROR: Could not affine thread");
- exit(EXIT_FAILURE);
- }
-
- while (ck_pr_load_uint(&ready) == 0);
-
- ck_pr_inc_uint(&barrier);
- while (ck_pr_load_uint(&barrier) != nthr);
-
- while (ready) {
- LOCK;
-
- count[i].value++;
- if (critical) {
- base = common_lrand48() % critical;
- for (j = 0; j < base; j++);
- }
-
- UNLOCK;
- }
-
- return (NULL);
-}
-
-int
-main(int argc, char *argv[])
-{
- uint64_t v, d;
- unsigned int i;
- pthread_t *threads;
- struct block *context;
-
- if (argc != 4) {
- ck_error("Usage: " LOCK_NAME " <number of threads> <affinity delta> <critical section>\n");
- exit(EXIT_FAILURE);
- }
-
- nthr = atoi(argv[1]);
- if (nthr <= 0) {
- ck_error("ERROR: Number of threads must be greater than 0\n");
- exit(EXIT_FAILURE);
- }
-
-#ifdef LOCK_INIT
- LOCK_INIT;
-#endif
-
- critical = atoi(argv[3]);
- if (critical < 0) {
- ck_error("ERROR: critical section cannot be negative\n");
- exit(EXIT_FAILURE);
- }
-
- threads = malloc(sizeof(pthread_t) * nthr);
- if (threads == NULL) {
- ck_error("ERROR: Could not allocate thread structures\n");
- exit(EXIT_FAILURE);
- }
-
- context = malloc(sizeof(struct block) * nthr);
- if (context == NULL) {
- ck_error("ERROR: Could not allocate thread contexts\n");
- exit(EXIT_FAILURE);
- }
-
- a.delta = atoi(argv[2]);
- a.request = 0;
-
- count = malloc(sizeof(*count) * nthr);
- if (count == NULL) {
- ck_error("ERROR: Could not create acquisition buffer\n");
- exit(EXIT_FAILURE);
- }
- memset(count, 0, sizeof(*count) * nthr);
-
- fprintf(stderr, "Creating threads (fairness)...");
- for (i = 0; i < nthr; i++) {
- context[i].tid = i;
- if (pthread_create(&threads[i], NULL, fairness, context + i)) {
- ck_error("ERROR: Could not create thread %d\n", i);
- exit(EXIT_FAILURE);
- }
- }
- fprintf(stderr, "done\n");
-
- ck_pr_store_uint(&ready, 1);
- common_sleep(10);
- ck_pr_store_uint(&ready, 0);
-
- fprintf(stderr, "Waiting for threads to finish acquisition regression...");
- for (i = 0; i < nthr; i++)
- pthread_join(threads[i], NULL);
- fprintf(stderr, "done\n\n");
-
- for (i = 0, v = 0; i < nthr; i++) {
- printf("%d %15" PRIu64 "\n", i, count[i].value);
- v += count[i].value;
- }
-
- printf("\n# total : %15" PRIu64 "\n", v);
- printf("# throughput : %15" PRIu64 " a/s\n", (v /= nthr) / 10);
-
- for (i = 0, d = 0; i < nthr; i++)
- d += (count[i].value - v) * (count[i].value - v);
-
- printf("# average : %15" PRIu64 "\n", v);
- printf("# deviation : %.2f (%.2f%%)\n\n", sqrt(d / nthr), (sqrt(d / nthr) / v) * 100.00);
-
- return (0);
-}
-
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/ck_anderson.h
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/ck_anderson.h b/lib/ck/regressions/ck_spinlock/ck_anderson.h
deleted file mode 100644
index 7dc8e6e..0000000
--- a/lib/ck/regressions/ck_spinlock/ck_anderson.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#define MAX(a,b) ((a) > (b) ? (a) : (b))
-#define LOCK_NAME "ck_anderson"
-#define LOCK_DEFINE static ck_spinlock_anderson_t lock CK_CC_CACHELINE
-#define LOCK_STATE ck_spinlock_anderson_thread_t *nad = NULL
-#define LOCK ck_spinlock_anderson_lock(&lock, &nad)
-#define UNLOCK ck_spinlock_anderson_unlock(&lock, nad)
-#define LOCK_INIT ck_spinlock_anderson_init(&lock, malloc(MAX(64,sizeof(ck_spinlock_anderson_thread_t)) * nthr), nthr)
-#define LOCKED ck_spinlock_anderson_locked(&lock)
-
-#define NO_LOCAL
-
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/ck_cas.h
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/ck_cas.h b/lib/ck/regressions/ck_spinlock/ck_cas.h
deleted file mode 100644
index bd4ae13..0000000
--- a/lib/ck/regressions/ck_spinlock/ck_cas.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#define LOCK_NAME "ck_cas"
-#define LOCK_DEFINE static ck_spinlock_cas_t CK_CC_CACHELINE lock = CK_SPINLOCK_CAS_INITIALIZER
-#define LOCK ck_spinlock_cas_lock_eb(&lock)
-#define UNLOCK ck_spinlock_cas_unlock(&lock)
-#define LOCKED ck_spinlock_cas_locked(&lock)
-
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/ck_clh.h
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/ck_clh.h b/lib/ck/regressions/ck_spinlock/ck_clh.h
deleted file mode 100644
index df7e49f..0000000
--- a/lib/ck/regressions/ck_spinlock/ck_clh.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#define MAX(a,b) ((a) > (b) ? (a) : (b))
-#define LOCK_NAME "ck_clh"
-#define LOCK_DEFINE static ck_spinlock_clh_t CK_CC_CACHELINE *lock = NULL
-#define LOCK_STATE ck_spinlock_clh_t *na = malloc(MAX(sizeof(ck_spinlock_clh_t), 64))
-#define LOCK ck_spinlock_clh_lock(&lock, na)
-#define UNLOCK ck_spinlock_clh_unlock(&na)
-#define LOCK_INIT ck_spinlock_clh_init(&lock, malloc(MAX(sizeof(ck_spinlock_clh_t), 64)))
-#define LOCKED ck_spinlock_clh_locked(&lock)
-
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/ck_dec.h
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/ck_dec.h b/lib/ck/regressions/ck_spinlock/ck_dec.h
deleted file mode 100644
index c21a390..0000000
--- a/lib/ck/regressions/ck_spinlock/ck_dec.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#define LOCK_NAME "ck_dec"
-#define LOCK_DEFINE static ck_spinlock_dec_t CK_CC_CACHELINE lock = CK_SPINLOCK_DEC_INITIALIZER
-#define LOCK ck_spinlock_dec_lock_eb(&lock)
-#define UNLOCK ck_spinlock_dec_unlock(&lock)
-#define LOCKED ck_spinlock_dec_locked(&lock)
-
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/ck_fas.h
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/ck_fas.h b/lib/ck/regressions/ck_spinlock/ck_fas.h
deleted file mode 100644
index e244746..0000000
--- a/lib/ck/regressions/ck_spinlock/ck_fas.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#define LOCK_NAME "ck_fas"
-#define LOCK_DEFINE static ck_spinlock_fas_t CK_CC_CACHELINE lock = CK_SPINLOCK_FAS_INITIALIZER
-#define LOCK ck_spinlock_fas_lock_eb(&lock)
-#define UNLOCK ck_spinlock_fas_unlock(&lock)
-#define LOCKED ck_spinlock_fas_locked(&lock)
-
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/ck_hclh.h
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/ck_hclh.h b/lib/ck/regressions/ck_spinlock/ck_hclh.h
deleted file mode 100644
index eb2e6eb..0000000
--- a/lib/ck/regressions/ck_spinlock/ck_hclh.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#define MAX(a,b) ((a) > (b) ? (a) : (b))
-#define LOCK_NAME "ck_clh"
-#define LOCK_DEFINE static ck_spinlock_hclh_t CK_CC_CACHELINE *glob_lock; \
- static ck_spinlock_hclh_t CK_CC_CACHELINE *local_lock[CORES / 2]
-#define LOCK_STATE ck_spinlock_hclh_t *na = malloc(MAX(sizeof(ck_spinlock_hclh_t), 64))
-#define LOCK ck_spinlock_hclh_lock(&glob_lock, &local_lock[(core % CORES) / 2], na)
-#define UNLOCK ck_spinlock_hclh_unlock(&na)
-#define LOCK_INIT do { \
- int _i; \
- ck_spinlock_hclh_init(&glob_lock, malloc(MAX(sizeof(ck_spinlock_hclh_t), 64)), -1); \
- for (_i = 0; _i < CORES / 2; _i++) { \
- ck_spinlock_hclh_init(&local_lock[_i], malloc(MAX(sizeof(ck_spinlock_hclh_t), 64)), _i); } \
-} while (0)
-
-#define LOCKED ck_spinlock_hclh_locked(&glob_lock)
-
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/ck_mcs.h
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/ck_mcs.h b/lib/ck/regressions/ck_spinlock/ck_mcs.h
deleted file mode 100644
index dd127df..0000000
--- a/lib/ck/regressions/ck_spinlock/ck_mcs.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#define LOCK_NAME "ck_mcs"
-#define LOCK_DEFINE static ck_spinlock_mcs_t CK_CC_CACHELINE lock = NULL
-#define LOCK_STATE ck_spinlock_mcs_context_t node CK_CC_CACHELINE;
-#define LOCK ck_spinlock_mcs_lock(&lock, &node)
-#define UNLOCK ck_spinlock_mcs_unlock(&lock, &node)
-#define LOCKED ck_spinlock_mcs_locked(&lock)
-
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/ck_spinlock.h
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/ck_spinlock.h b/lib/ck/regressions/ck_spinlock/ck_spinlock.h
deleted file mode 100644
index 938e1ce..0000000
--- a/lib/ck/regressions/ck_spinlock/ck_spinlock.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#define LOCK_NAME "ck_spinlock"
-#define LOCK_DEFINE static ck_spinlock_t CK_CC_CACHELINE lock = CK_SPINLOCK_INITIALIZER
-#define LOCK ck_spinlock_lock_eb(&lock)
-#define UNLOCK ck_spinlock_unlock(&lock)
-#define LOCKED ck_spinlock_locked(&lock)
-
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/ck_ticket.h
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/ck_ticket.h b/lib/ck/regressions/ck_spinlock/ck_ticket.h
deleted file mode 100644
index 39054a6..0000000
--- a/lib/ck/regressions/ck_spinlock/ck_ticket.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <ck_spinlock.h>
-
-#define LOCK_NAME "ck_ticket"
-#define LOCK_DEFINE static ck_spinlock_ticket_t CK_CC_CACHELINE lock = CK_SPINLOCK_TICKET_INITIALIZER
-#define LOCK ck_spinlock_ticket_lock(&lock)
-#define UNLOCK ck_spinlock_ticket_unlock(&lock)
-#ifdef CK_F_SPINLOCK_TICKET_TRYLOCK
-#define TRYLOCK ck_spinlock_ticket_trylock(&lock)
-#endif
-#define LOCKED ck_spinlock_ticket_locked(&lock)
-
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/ck_ticket_pb.h
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/ck_ticket_pb.h b/lib/ck/regressions/ck_spinlock/ck_ticket_pb.h
deleted file mode 100644
index b8a7a84..0000000
--- a/lib/ck/regressions/ck_spinlock/ck_ticket_pb.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#define LOCK_NAME "ck_ticket_pb"
-#define LOCK_DEFINE static ck_spinlock_ticket_t CK_CC_CACHELINE lock = CK_SPINLOCK_TICKET_INITIALIZER
-#define LOCK ck_spinlock_ticket_lock_pb(&lock, 0)
-#define UNLOCK ck_spinlock_ticket_unlock(&lock)
-#define LOCKED ck_spinlock_ticket_locked(&lock)
-
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/linux_spinlock.h
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/linux_spinlock.h b/lib/ck/regressions/ck_spinlock/linux_spinlock.h
deleted file mode 100644
index 5fe1f3e..0000000
--- a/lib/ck/regressions/ck_spinlock/linux_spinlock.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#include <ck_cc.h>
-
-CK_CC_INLINE static void
-spin_lock(volatile unsigned int *lock)
-{
-#ifdef __x86_64__
- __asm__ __volatile__(
- "\n1:\t"
- "lock ; decl %0\n\t"
- "jns 2f\n"
- "3:\n"
- "rep;nop\n\t"
- "cmpl $0,%0\n\t"
- "jle 3b\n\t"
- "jmp 1b\n"
- "2:\t" : "=m" (*lock) : : "memory");
-#else
- *lock = 1;
-#endif
-
- return;
-}
-
-CK_CC_INLINE static void
-spin_unlock(volatile unsigned int *lock)
-{
-#ifdef __x86_64__
- __asm__ __volatile__("movl $1,%0" :"=m" (*lock) :: "memory");
-#else
- *lock = 0;
- return;
-#endif
-}
-
-#define LOCK_NAME "linux_spinlock"
-#define LOCK_DEFINE volatile unsigned int lock = 1
-#define LOCK spin_lock(&lock)
-#define UNLOCK spin_unlock(&lock)
-
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/validate/Makefile
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/validate/Makefile b/lib/ck/regressions/ck_spinlock/validate/Makefile
deleted file mode 100644
index 0d78e09..0000000
--- a/lib/ck/regressions/ck_spinlock/validate/Makefile
+++ /dev/null
@@ -1,56 +0,0 @@
-.PHONY: check clean
-
-all: ck_ticket ck_mcs ck_dec ck_cas ck_fas ck_clh linux_spinlock \
- ck_ticket_pb ck_anderson ck_spinlock ck_hclh
-
-check: all
- ./ck_ticket $(CORES) 1
- ./ck_mcs $(CORES) 1
- ./ck_dec $(CORES) 1
- ./ck_cas $(CORES) 1
- ./ck_fas $(CORES) 1
- ./ck_clh $(CORES) 1
- ./linux_spinlock $(CORES) 1
- ./ck_ticket_pb $(CORES) 1
- ./ck_anderson $(CORES) 1
- ./ck_spinlock $(CORES) 1
-
-linux_spinlock: linux_spinlock.c
- $(CC) $(CFLAGS) -o linux_spinlock linux_spinlock.c
-
-ck_spinlock: ck_spinlock.c
- $(CC) $(CFLAGS) -o ck_spinlock ck_spinlock.c
-
-ck_ticket_pb: ck_ticket_pb.c
- $(CC) $(CFLAGS) -o ck_ticket_pb ck_ticket_pb.c
-
-ck_clh: ck_clh.c
- $(CC) $(CFLAGS) -o ck_clh ck_clh.c
-
-ck_hclh: ck_hclh.c
- $(CC) $(CFLAGS) -o ck_hclh ck_hclh.c
-
-ck_anderson: ck_anderson.c
- $(CC) $(CFLAGS) -o ck_anderson ck_anderson.c
-
-ck_fas: ck_fas.c
- $(CC) $(CFLAGS) -o ck_fas ck_fas.c
-
-ck_ticket: ck_ticket.c
- $(CC) $(CFLAGS) -o ck_ticket ck_ticket.c
-
-ck_cas: ck_cas.c
- $(CC) $(CFLAGS) -o ck_cas ck_cas.c
-
-ck_mcs: ck_mcs.c
- $(CC) $(CFLAGS) -o ck_mcs ck_mcs.c
-
-ck_dec: ck_dec.c
- $(CC) $(CFLAGS) -o ck_dec ck_dec.c
-
-clean:
- rm -rf ck_ticket ck_mcs ck_dec ck_cas ck_fas ck_clh linux_spinlock ck_ticket_pb \
- ck_anderson ck_spinlock ck_hclh *.dSYM *.exe
-
-include ../../../build/regressions.build
-CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE -lm
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/validate/ck_anderson.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/validate/ck_anderson.c b/lib/ck/regressions/ck_spinlock/validate/ck_anderson.c
deleted file mode 100644
index b10900c..0000000
--- a/lib/ck/regressions/ck_spinlock/validate/ck_anderson.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "../ck_anderson.h"
-#include "validate.h"
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/validate/ck_cas.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/validate/ck_cas.c b/lib/ck/regressions/ck_spinlock/validate/ck_cas.c
deleted file mode 100644
index 162490a..0000000
--- a/lib/ck/regressions/ck_spinlock/validate/ck_cas.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "../ck_cas.h"
-#include "validate.h"
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/validate/ck_clh.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/validate/ck_clh.c b/lib/ck/regressions/ck_spinlock/validate/ck_clh.c
deleted file mode 100644
index 19cb512..0000000
--- a/lib/ck/regressions/ck_spinlock/validate/ck_clh.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "../ck_clh.h"
-#include "validate.h"
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/validate/ck_dec.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/validate/ck_dec.c b/lib/ck/regressions/ck_spinlock/validate/ck_dec.c
deleted file mode 100644
index fd351de..0000000
--- a/lib/ck/regressions/ck_spinlock/validate/ck_dec.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "../ck_dec.h"
-#include "validate.h"
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/validate/ck_fas.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/validate/ck_fas.c b/lib/ck/regressions/ck_spinlock/validate/ck_fas.c
deleted file mode 100644
index 5cf4071..0000000
--- a/lib/ck/regressions/ck_spinlock/validate/ck_fas.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "../ck_fas.h"
-#include "validate.h"
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/validate/ck_hclh.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/validate/ck_hclh.c b/lib/ck/regressions/ck_spinlock/validate/ck_hclh.c
deleted file mode 100644
index 001f57b..0000000
--- a/lib/ck/regressions/ck_spinlock/validate/ck_hclh.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "../ck_hclh.h"
-#include "validate.h"
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/validate/ck_mcs.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/validate/ck_mcs.c b/lib/ck/regressions/ck_spinlock/validate/ck_mcs.c
deleted file mode 100644
index 7adad43..0000000
--- a/lib/ck/regressions/ck_spinlock/validate/ck_mcs.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "../ck_mcs.h"
-#include "validate.h"
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/validate/ck_spinlock.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/validate/ck_spinlock.c b/lib/ck/regressions/ck_spinlock/validate/ck_spinlock.c
deleted file mode 100644
index e682905..0000000
--- a/lib/ck/regressions/ck_spinlock/validate/ck_spinlock.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "../ck_spinlock.h"
-#include "validate.h"
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/validate/ck_ticket.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/validate/ck_ticket.c b/lib/ck/regressions/ck_spinlock/validate/ck_ticket.c
deleted file mode 100644
index be67254..0000000
--- a/lib/ck/regressions/ck_spinlock/validate/ck_ticket.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "../ck_ticket.h"
-#include "validate.h"
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/validate/ck_ticket_pb.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/validate/ck_ticket_pb.c b/lib/ck/regressions/ck_spinlock/validate/ck_ticket_pb.c
deleted file mode 100644
index e62ee0e..0000000
--- a/lib/ck/regressions/ck_spinlock/validate/ck_ticket_pb.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "../ck_ticket_pb.h"
-#include "validate.h"
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/validate/linux_spinlock.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/validate/linux_spinlock.c b/lib/ck/regressions/ck_spinlock/validate/linux_spinlock.c
deleted file mode 100644
index 781e419..0000000
--- a/lib/ck/regressions/ck_spinlock/validate/linux_spinlock.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifdef __x86_64__
-#include "../linux_spinlock.h"
-#include "validate.h"
-#else
-#include <stdio.h>
-
-int
-main(void)
-{
-
- fprintf(stderr, "Unsupported.\n");
- return 0;
-}
-#endif
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_spinlock/validate/validate.h
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_spinlock/validate/validate.h b/lib/ck/regressions/ck_spinlock/validate/validate.h
deleted file mode 100644
index a0c9612..0000000
--- a/lib/ck/regressions/ck_spinlock/validate/validate.h
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Copyright 2011-2014 Samy Al Bahra.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <errno.h>
-#include <inttypes.h>
-#include <pthread.h>
-#include <math.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <strings.h>
-#include <unistd.h>
-#include <sys/time.h>
-
-#include <ck_cc.h>
-#include <ck_pr.h>
-#include <ck_spinlock.h>
-
-#include "../../common.h"
-
-#ifndef ITERATE
-#define ITERATE 1000000
-#endif
-
-struct block {
- unsigned int tid;
-};
-
-static struct affinity a;
-static unsigned int locked = 0;
-static uint64_t nthr;
-
-LOCK_DEFINE;
-
-static void *
-thread(void *null CK_CC_UNUSED)
-{
-#ifdef LOCK_STATE
- LOCK_STATE;
-#endif
- unsigned int i = ITERATE;
- unsigned int j;
- unsigned int core;
-
- if (aff_iterate_core(&a, &core)) {
- perror("ERROR: Could not affine thread");
- exit(EXIT_FAILURE);
- }
-
- while (i--) {
-#ifdef TRYLOCK
- if (i & 1) {
- LOCK;
- } else {
- while (TRYLOCK == false)
- ck_pr_stall();
- }
-#else
- LOCK;
-#endif
-
-#ifdef LOCKED
- if (LOCKED == false)
- ck_error("is_locked operation failed.");
-#endif
-
- ck_pr_inc_uint(&locked);
- ck_pr_inc_uint(&locked);
- ck_pr_inc_uint(&locked);
- ck_pr_inc_uint(&locked);
- ck_pr_inc_uint(&locked);
- ck_pr_inc_uint(&locked);
- ck_pr_inc_uint(&locked);
- ck_pr_inc_uint(&locked);
- ck_pr_inc_uint(&locked);
- ck_pr_inc_uint(&locked);
-
- j = ck_pr_load_uint(&locked);
-
- if (j != 10) {
- ck_error("ERROR (WR): Race condition (%u)\n", j);
- exit(EXIT_FAILURE);
- }
-
- ck_pr_dec_uint(&locked);
- ck_pr_dec_uint(&locked);
- ck_pr_dec_uint(&locked);
- ck_pr_dec_uint(&locked);
- ck_pr_dec_uint(&locked);
- ck_pr_dec_uint(&locked);
- ck_pr_dec_uint(&locked);
- ck_pr_dec_uint(&locked);
- ck_pr_dec_uint(&locked);
- ck_pr_dec_uint(&locked);
-
- UNLOCK;
-
- LOCK;
-
- j = ck_pr_load_uint(&locked);
- if (j != 0) {
- ck_error("ERROR (RD): Race condition (%u)\n", j);
- exit(EXIT_FAILURE);
- }
-
- UNLOCK;
- }
-
- return (NULL);
-}
-
-int
-main(int argc, char *argv[])
-{
- uint64_t i;
- pthread_t *threads;
-
- if (argc != 3) {
- ck_error("Usage: " LOCK_NAME " <number of threads> <affinity delta>\n");
- exit(EXIT_FAILURE);
- }
-
- nthr = atoi(argv[1]);
- if (nthr <= 0) {
- ck_error("ERROR: Number of threads must be greater than 0\n");
- exit(EXIT_FAILURE);
- }
-
-#ifdef LOCK_INIT
- LOCK_INIT;
-#endif
-
- threads = malloc(sizeof(pthread_t) * nthr);
- if (threads == NULL) {
- ck_error("ERROR: Could not allocate thread structures\n");
- exit(EXIT_FAILURE);
- }
-
- a.delta = atoi(argv[2]);
- a.request = 0;
-
- fprintf(stderr, "Creating threads (mutual exclusion)...");
- for (i = 0; i < nthr; i++) {
- if (pthread_create(&threads[i], NULL, thread, NULL)) {
- ck_error("ERROR: Could not create thread %" PRIu64 "\n", i);
- exit(EXIT_FAILURE);
- }
- }
- fprintf(stderr, "done\n");
-
- fprintf(stderr, "Waiting for threads to finish correctness regression...");
- for (i = 0; i < nthr; i++)
- pthread_join(threads[i], NULL);
- fprintf(stderr, "done (passed)\n");
-
- return (0);
-}
-
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_stack/benchmark/Makefile
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_stack/benchmark/Makefile b/lib/ck/regressions/ck_stack/benchmark/Makefile
deleted file mode 100644
index 6e2df2a..0000000
--- a/lib/ck/regressions/ck_stack/benchmark/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-.PHONY: clean distribution
-
-OBJECTS=latency
-
-all: $(OBJECTS)
-
-latency: latency.c
- $(CC) $(CFLAGS) -o latency latency.c
-
-clean:
- rm -rf *~ *.o *.dSYM *.exe $(OBJECTS)
-
-include ../../../build/regressions.build
-CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_stack/benchmark/latency.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_stack/benchmark/latency.c b/lib/ck/regressions/ck_stack/benchmark/latency.c
deleted file mode 100644
index 1bca94c..0000000
--- a/lib/ck/regressions/ck_stack/benchmark/latency.c
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Copyright 2011-2014 Samy Al Bahra.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <ck_stack.h>
-#include <ck_spinlock.h>
-#include <inttypes.h>
-#include <stdint.h>
-#include <stdio.h>
-
-#include "../../common.h"
-
-#ifndef ENTRIES
-#define ENTRIES 4096
-#endif
-
-#ifndef STEPS
-#define STEPS 40000
-#endif
-
-/*
- * Note the redundant post-increment of r. This is to silence
- * some irrelevant GCC warnings.
- */
-
-static ck_stack_t stack CK_CC_CACHELINE;
-
-int
-main(void)
-{
- ck_stack_entry_t entry[ENTRIES];
- ck_spinlock_fas_t mutex = CK_SPINLOCK_FAS_INITIALIZER;
- volatile ck_stack_entry_t * volatile r;
- uint64_t s, e, a;
- unsigned int i;
- unsigned int j;
-
- a = 0;
- for (i = 0; i < STEPS; i++) {
- ck_stack_init(&stack);
-
- s = rdtsc();
- for (j = 0; j < ENTRIES; j++) {
- ck_spinlock_fas_lock(&mutex);
- ck_stack_push_spnc(&stack, entry + j);
- ck_spinlock_fas_unlock(&mutex);
- }
- e = rdtsc();
-
- a += e - s;
- }
- printf(" spinlock_push: %16" PRIu64 "\n", a / STEPS / ENTRIES);
-
- a = 0;
- for (i = 0; i < STEPS; i++) {
- ck_stack_init(&stack);
-
- for (j = 0; j < ENTRIES; j++)
- ck_stack_push_spnc(&stack, entry + j);
-
- s = rdtsc();
- for (j = 0; j < ENTRIES; j++) {
- ck_spinlock_fas_lock(&mutex);
- r = ck_stack_pop_npsc(&stack);
- ck_spinlock_fas_unlock(&mutex);
- }
- e = rdtsc();
- a += e - s;
- }
- printf(" spinlock_pop: %16" PRIu64 "\n", a / STEPS / ENTRIES);
- r++;
-
-#ifdef CK_F_STACK_PUSH_UPMC
- a = 0;
- for (i = 0; i < STEPS; i++) {
- ck_stack_init(&stack);
-
- s = rdtsc();
- for (j = 0; j < ENTRIES; j++)
- ck_stack_push_upmc(&stack, entry + j);
- e = rdtsc();
-
- a += e - s;
- }
- printf("ck_stack_push_upmc: %16" PRIu64 "\n", a / STEPS / ENTRIES);
-#endif /* CK_F_STACK_PUSH_UPMC */
-
-#ifdef CK_F_STACK_PUSH_MPMC
- a = 0;
- for (i = 0; i < STEPS; i++) {
- ck_stack_init(&stack);
-
- s = rdtsc();
- for (j = 0; j < ENTRIES; j++)
- ck_stack_push_mpmc(&stack, entry + j);
- e = rdtsc();
-
- a += e - s;
- }
- printf("ck_stack_push_mpmc: %16" PRIu64 "\n", a / STEPS / ENTRIES);
-#endif /* CK_F_STACK_PUSH_MPMC */
-
-#ifdef CK_F_STACK_PUSH_MPNC
- a = 0;
- for (i = 0; i < STEPS; i++) {
- ck_stack_init(&stack);
-
- s = rdtsc();
- for (j = 0; j < ENTRIES; j++)
- ck_stack_push_mpnc(&stack, entry + j);
- e = rdtsc();
-
- a += e - s;
- }
- printf("ck_stack_push_mpnc: %16" PRIu64 "\n", a / STEPS / ENTRIES);
-#endif /* CK_F_STACK_PUSH_MPNC */
-
-#if defined(CK_F_STACK_PUSH_UPMC) && defined(CK_F_STACK_POP_UPMC)
- a = 0;
- for (i = 0; i < STEPS; i++) {
- ck_stack_init(&stack);
-
- for (j = 0; j < ENTRIES; j++)
- ck_stack_push_upmc(&stack, entry + j);
-
- s = rdtsc();
- for (j = 0; j < ENTRIES; j++)
- r = ck_stack_pop_upmc(&stack);
- e = rdtsc();
- a += e - s;
- }
- printf(" ck_stack_pop_upmc: %16" PRIu64 "\n", a / STEPS / (sizeof(entry) / sizeof(*entry)));
-#endif /* CK_F_STACK_PUSH_UPMC && CK_F_STACK_POP_UPMC */
-
-#if defined(CK_F_STACK_POP_MPMC) && defined(CK_F_STACK_PUSH_MPMC)
- a = 0;
- for (i = 0; i < STEPS; i++) {
- ck_stack_init(&stack);
-
- for (j = 0; j < ENTRIES; j++)
- ck_stack_push_mpmc(&stack, entry + j);
-
- s = rdtsc();
- for (j = 0; j < ENTRIES; j++)
- r = ck_stack_pop_mpmc(&stack);
- e = rdtsc();
- a += e - s;
- }
- printf(" ck_stack_pop_mpmc: %16" PRIu64 "\n", a / STEPS / (sizeof(entry) / sizeof(*entry)));
- r++;
-#endif
-
- return 0;
-}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_stack/validate/Makefile
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_stack/validate/Makefile b/lib/ck/regressions/ck_stack/validate/Makefile
deleted file mode 100644
index 519dca1..0000000
--- a/lib/ck/regressions/ck_stack/validate/Makefile
+++ /dev/null
@@ -1,56 +0,0 @@
-.PHONY: check clean distribution
-
-OBJECTS=serial mpnc_push mpmc_push upmc_push spinlock_push spinlock_eb_push \
- mpmc_pop upmc_pop spinlock_pop spinlock_eb_pop \
- upmc_trypop mpmc_trypop mpmc_trypair \
- mpmc_pair spinlock_pair spinlock_eb_pair pthreads_pair \
- mpmc_trypush upmc_trypush
-
-all: $(OBJECTS)
-
-check: all
- ./serial
- ./mpmc_pair $(CORES) 1 0
- ./upmc_trypop $(CORES) 1 0
- ./mpmc_trypop $(CORES) 1 0
- ./mpmc_trypair $(CORES) 1 0
- ./mpmc_pop $(CORES) 1 0
- ./upmc_pop $(CORES) 1 0
- ./mpnc_push $(CORES) 1 0
- ./mpmc_push $(CORES) 1 0
- ./upmc_push $(CORES) 1 0
- ./mpmc_trypush $(CORES) 1 0
- ./upmc_trypush $(CORES) 1 0
-
-serial: serial.c
- $(CC) $(CFLAGS) -o serial serial.c
-
-mpmc_trypush upmc_trypush mpnc_push mpmc_push upmc_push spinlock_push spinlock_eb_push: push.c
- $(CC) -DTRYUPMC $(CFLAGS) -o upmc_trypush push.c
- $(CC) -DTRYMPMC $(CFLAGS) -o mpmc_trypush push.c
- $(CC) -DMPNC $(CFLAGS) -o mpnc_push push.c
- $(CC) -DMPMC $(CFLAGS) -o mpmc_push push.c
- $(CC) -DUPMC $(CFLAGS) -o upmc_push push.c
- $(CC) -DSPINLOCK $(CFLAGS) -o spinlock_push push.c
- $(CC) -DSPINLOCK -DEB $(CFLAGS) -o spinlock_eb_push push.c
-
-upmc_trypop mpmc_trypop mpmc_pop tryupmc_pop upmc_pop spinlock_pop spinlock_eb_pop: pop.c
- $(CC) -DTRYMPMC $(CFLAGS) -o mpmc_trypop pop.c
- $(CC) -DTRYUPMC $(CFLAGS) -o upmc_trypop pop.c
- $(CC) -DMPMC $(CFLAGS) -o mpmc_pop pop.c
- $(CC) -DUPMC $(CFLAGS) -o upmc_pop pop.c
- $(CC) -DSPINLOCK $(CFLAGS) -o spinlock_pop pop.c
- $(CC) -DEB -DSPINLOCK $(CFLAGS) -o spinlock_eb_pop pop.c
-
-mpmc_trypair mpmc_pair spinlock_pair spinlock_eb_pair pthreads_pair: pair.c
- $(CC) -DTRYMPMC $(CFLAGS) -o mpmc_trypair pair.c
- $(CC) -DMPMC $(CFLAGS) -o mpmc_pair pair.c
- $(CC) -DSPINLOCK $(CFLAGS) -o spinlock_pair pair.c
- $(CC) -DEB -DSPINLOCK $(CFLAGS) -o spinlock_eb_pair pair.c
- $(CC) -DPTHREADS $(CFLAGS) -o pthreads_pair pair.c
-
-clean:
- rm -rf *~ *.o *.dSYM *.exe $(OBJECTS)
-
-include ../../../build/regressions.build
-CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_stack/validate/pair.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_stack/validate/pair.c b/lib/ck/regressions/ck_stack/validate/pair.c
deleted file mode 100644
index c0f1bb1..0000000
--- a/lib/ck/regressions/ck_stack/validate/pair.c
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- * Copyright 2009 Samy Al Bahra.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <assert.h>
-#include <ck_cc.h>
-#include <ck_pr.h>
-#ifdef SPINLOCK
-#include <ck_spinlock.h>
-#endif
-#include <ck_stack.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <pthread.h>
-#include <sys/time.h>
-#include <unistd.h>
-
-#include "../../common.h"
-
-#ifndef ITEMS
-#define ITEMS (5765760)
-#endif
-
-#define TVTOD(tv) ((tv).tv_sec+((tv).tv_usec / (double)1000000))
-
-struct entry {
- int value;
-#if defined(SPINLOCK) || defined(PTHREADS)
- struct entry *next;
-#else
- ck_stack_entry_t next;
-#endif
-} CK_CC_CACHELINE;
-
-#ifdef SPINLOCK
-static struct entry *stack CK_CC_CACHELINE;
-ck_spinlock_fas_t stack_spinlock = CK_SPINLOCK_FAS_INITIALIZER;
-#define UNLOCK ck_spinlock_fas_unlock
-#if defined(EB)
-#define LOCK ck_spinlock_fas_lock_eb
-#else
-#define LOCK ck_spinlock_fas_lock
-#endif
-#elif defined(PTHREADS)
-static struct entry *stack CK_CC_CACHELINE;
-pthread_mutex_t stack_spinlock = PTHREAD_MUTEX_INITIALIZER;
-#define LOCK pthread_mutex_lock
-#define UNLOCK pthread_mutex_unlock
-#else
-static ck_stack_t stack CK_CC_CACHELINE;
-CK_STACK_CONTAINER(struct entry, next, getvalue)
-#endif
-
-static struct affinity affinerator;
-static unsigned long long nthr;
-static volatile unsigned int barrier = 0;
-static unsigned int critical;
-
-static void *
-stack_thread(void *buffer)
-{
-#if (defined(MPMC) && defined(CK_F_STACK_POP_MPMC)) || (defined(UPMC) && defined(CK_F_STACK_POP_UPMC)) || (defined(TRYUPMC) && defined(CK_F_STACK_TRYPOP_UPMC)) || (defined(TRYMPMC) && defined(CK_F_STACK_TRYPOP_MPMC))
- ck_stack_entry_t *ref;
-#endif
- struct entry *entry = buffer;
- unsigned long long i, n = ITEMS;
- unsigned int seed;
- int j;
-
- if (aff_iterate(&affinerator)) {
- perror("ERROR: failed to affine thread");
- exit(EXIT_FAILURE);
- }
-
- while (barrier == 0);
-
- for (i = 0; i < n; i++) {
-#if defined(MPMC)
- ck_stack_push_mpmc(&stack, &entry->next);
-#elif defined(TRYMPMC)
- while (ck_stack_trypush_mpmc(&stack, &entry->next) == false)
- ck_pr_stall();
-#elif defined(UPMC)
- ck_stack_push_upmc(&stack, &entry->next);
-#elif defined(TRYUPMC)
- while (ck_stack_trypush_upmc(&stack, &entry->next) == false)
- ck_pr_stall();
-#elif defined(SPINLOCK) || defined(PTHREADS)
- LOCK(&stack_spinlock);
- ck_pr_store_ptr(&entry->next, stack);
- ck_pr_store_ptr(&stack, entry);
- UNLOCK(&stack_spinlock);
-#else
-# error Undefined operation.
-#endif
-
- if (critical) {
- j = common_rand_r(&seed) % critical;
- while (j--)
- __asm__ __volatile__("" ::: "memory");
- }
-
-#if defined(MPMC)
-#ifdef CK_F_STACK_POP_MPMC
- ref = ck_stack_pop_mpmc(&stack);
- entry = getvalue(ref);
-#endif
-#elif defined(TRYMPMC)
-#ifdef CK_F_STACK_TRYPOP_MPMC
- while (ck_stack_trypop_mpmc(&stack, &ref) == false)
- ck_pr_stall();
- entry = getvalue(ref);
-#endif /* CK_F_STACK_TRYPOP_MPMC */
-#elif defined(UPMC)
- ref = ck_stack_pop_upmc(&stack);
- entry = getvalue(ref);
-#elif defined(SPINLOCK) || defined(PTHREADS)
- LOCK(&stack_spinlock);
- entry = stack;
- stack = stack->next;
- UNLOCK(&stack_spinlock);
-#else
-# error Undefined operation.
-#endif
- }
-
- return (NULL);
-}
-
-static void
-stack_assert(void)
-{
-
-#if defined(SPINLOCK) || defined(PTHREADS)
- assert(stack == NULL);
-#else
- assert(CK_STACK_ISEMPTY(&stack));
-#endif
- return;
-}
-
-int
-main(int argc, char *argv[])
-{
- struct entry *bucket;
- unsigned long long i, d;
- pthread_t *thread;
- struct timeval stv, etv;
-
-#if (defined(TRYMPMC) || defined(MPMC)) && (!defined(CK_F_STACK_PUSH_MPMC) || !defined(CK_F_STACK_POP_MPMC))
- fprintf(stderr, "Unsupported.\n");
- return 0;
-#endif
-
- if (argc != 4) {
- ck_error("Usage: stack <threads> <delta> <critical>\n");
- }
-
- {
- char *e;
-
- nthr = strtol(argv[1], &e, 10);
- if (errno == ERANGE) {
- perror("ERROR: too many threads");
- exit(EXIT_FAILURE);
- } else if (*e != '\0') {
- ck_error("ERROR: input format is incorrect\n");
- }
-
- d = strtol(argv[2], &e, 10);
- if (errno == ERANGE) {
- perror("ERROR: delta is too large");
- exit(EXIT_FAILURE);
- } else if (*e != '\0') {
- ck_error("ERROR: input format is incorrect\n");
- }
-
- critical = strtoul(argv[3], &e, 10);
- if (errno == ERANGE) {
- perror("ERROR: critical section is too large");
- exit(EXIT_FAILURE);
- } else if (*e != '\0') {
- ck_error("ERROR: input format is incorrect\n");
- }
- }
-
- srand(getpid());
-
- affinerator.request = 0;
- affinerator.delta = d;
-
- bucket = malloc(sizeof(struct entry) * nthr);
- assert(bucket != NULL);
-
- thread = malloc(sizeof(pthread_t) * nthr);
- assert(thread != NULL);
-
- for (i = 0; i < nthr; i++)
- pthread_create(&thread[i], NULL, stack_thread, bucket + i);
-
- barrier = 1;
-
- for (i = 0; i < nthr; i++)
- pthread_join(thread[i], NULL);
-
- barrier = 0;
-
- for (i = 0; i < nthr; i++)
- pthread_create(&thread[i], NULL, stack_thread, bucket + i);
-
- common_gettimeofday(&stv, NULL);
- barrier = 1;
- for (i = 0; i < nthr; i++)
- pthread_join(thread[i], NULL);
- common_gettimeofday(&etv, NULL);
-
- stack_assert();
-#ifdef _WIN32
- printf("%3llu %.6f\n", nthr, TVTOD(etv) - TVTOD(stv));
-#else
- printf("%3llu %.6lf\n", nthr, TVTOD(etv) - TVTOD(stv));
-#endif
- return 0;
-}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_stack/validate/pop.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_stack/validate/pop.c b/lib/ck/regressions/ck_stack/validate/pop.c
deleted file mode 100644
index ec31a52..0000000
--- a/lib/ck/regressions/ck_stack/validate/pop.c
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * Copyright 2009-2014 Samy Al Bahra.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <assert.h>
-#include <ck_cc.h>
-#include <ck_pr.h>
-#ifdef SPINLOCK
-#include <ck_spinlock.h>
-#endif
-#include <ck_stack.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <pthread.h>
-#include <sys/time.h>
-#include <unistd.h>
-
-#include "../../common.h"
-
-#ifndef ITEMS
-#define ITEMS (5765760 * 2)
-#endif
-
-#define TVTOD(tv) ((tv).tv_sec+((tv).tv_usec / (double)1000000))
-
-struct entry {
- int value;
-#ifdef SPINLOCK
- struct entry *next;
-#else
- ck_stack_entry_t next;
-#endif
-};
-
-#ifdef SPINLOCK
-static struct entry *stack CK_CC_CACHELINE;
-ck_spinlock_fas_t stack_spinlock = CK_SPINLOCK_FAS_INITIALIZER;
-#define UNLOCK ck_spinlock_fas_unlock
-#if defined(EB)
-#define LOCK ck_spinlock_fas_lock_eb
-#else
-#define LOCK ck_spinlock_fas_lock
-#endif
-#else
-static ck_stack_t stack CK_CC_CACHELINE;
-CK_STACK_CONTAINER(struct entry, next, getvalue)
-#endif
-
-static struct affinity affinerator = AFFINITY_INITIALIZER;
-static unsigned long long nthr;
-static volatile unsigned int barrier = 0;
-static unsigned int critical;
-
-static void *
-stack_thread(void *unused CK_CC_UNUSED)
-{
-#if (defined(MPMC) && defined(CK_F_STACK_POP_MPMC)) || (defined(UPMC) && defined(CK_F_STACK_POP_UPMC)) || (defined(TRYMPMC) && defined(CK_F_STACK_TRYPOP_MPMC)) || (defined(TRYUPMC) && defined(CK_F_STACK_TRYPOP_UPMC))
- ck_stack_entry_t *ref;
-#endif
- struct entry *entry = NULL;
- unsigned long long i, n = ITEMS / nthr;
- unsigned int seed;
- int j, previous = INT_MAX;
-
- if (aff_iterate(&affinerator)) {
- perror("ERROR: failed to affine thread");
- exit(EXIT_FAILURE);
- }
-
- while (barrier == 0);
-
- for (i = 0; i < n; i++) {
-#ifdef MPMC
-#ifdef CK_F_STACK_POP_MPMC
- ref = ck_stack_pop_mpmc(&stack);
- assert(ref);
- entry = getvalue(ref);
-#endif /* CK_F_STACK_POP_MPMC */
-#elif defined(TRYMPMC)
-#ifdef CK_F_STACK_TRYPOP_MPMC
- while (ck_stack_trypop_mpmc(&stack, &ref) == false)
- ck_pr_stall();
- assert(ref);
- entry = getvalue(ref);
-#endif /* CK_F_STACK_TRYPOP_MPMC */
-#elif defined(UPMC)
- ref = ck_stack_pop_upmc(&stack);
- assert(ref);
- entry = getvalue(ref);
-#elif defined(TRYUPMC)
- while (ck_stack_trypop_upmc(&stack, &ref) == false)
- ck_pr_stall();
- assert(ref);
- entry = getvalue(ref);
-#elif defined(SPINLOCK)
- LOCK(&stack_spinlock);
- entry = stack;
- stack = stack->next;
- UNLOCK(&stack_spinlock);
-#else
-# error Undefined operation.
-#endif
-
- if (critical) {
- j = common_rand_r(&seed) % critical;
- while (j--)
- __asm__ __volatile__("" ::: "memory");
- }
-
- assert (previous >= entry->value);
- previous = entry->value;
- }
-
- return (NULL);
-}
-
-static void
-stack_assert(void)
-{
-
-#ifdef SPINLOCK
- assert(stack == NULL);
-#else
- assert(CK_STACK_ISEMPTY(&stack));
-#endif
- return;
-}
-
-static void
-push_stack(struct entry *bucket)
-{
- unsigned long long i;
-
-#ifdef SPINLOCK
- stack = NULL;
-#else
- ck_stack_init(&stack);
-#endif
-
- for (i = 0; i < ITEMS; i++) {
- bucket[i].value = i % INT_MAX;
-#ifdef SPINLOCK
- bucket[i].next = stack;
- stack = bucket + i;
-#else
- ck_stack_push_spnc(&stack, &bucket[i].next);
-#endif
- }
-
-#ifndef SPINLOCK
- ck_stack_entry_t *entry;
- i = 0;
- CK_STACK_FOREACH(&stack, entry) {
- i++;
- }
- assert(i == ITEMS);
-#endif
-
- return;
-}
-
-int
-main(int argc, char *argv[])
-{
- struct entry *bucket;
- unsigned long long i, d;
- pthread_t *thread;
- struct timeval stv, etv;
-
-#if (defined(TRYMPMC) || defined(MPMC)) && (!defined(CK_F_STACK_PUSH_MPMC) || !defined(CK_F_STACK_POP_MPMC))
- fprintf(stderr, "Unsupported.\n");
- return 0;
-#endif
-
- if (argc != 4) {
- ck_error("Usage: stack <threads> <delta> <critical>\n");
- }
-
- {
- char *e;
-
- nthr = strtol(argv[1], &e, 10);
- if (errno == ERANGE) {
- perror("ERROR: too many threads");
- exit(EXIT_FAILURE);
- } else if (*e != '\0') {
- ck_error("ERROR: input format is incorrect\n");
- }
-
- d = strtol(argv[2], &e, 10);
- if (errno == ERANGE) {
- perror("ERROR: delta is too large");
- exit(EXIT_FAILURE);
- } else if (*e != '\0') {
- ck_error("ERROR: input format is incorrect\n");
- }
-
- critical = strtoul(argv[3], &e, 10);
- if (errno == ERANGE) {
- perror("ERROR: critical section is too large");
- exit(EXIT_FAILURE);
- } else if (*e != '\0') {
- ck_error("ERROR: input format is incorrect\n");
- }
- }
-
- srand(getpid());
-
- affinerator.delta = d;
- bucket = malloc(sizeof(struct entry) * ITEMS);
- assert(bucket != NULL);
-
- thread = malloc(sizeof(pthread_t) * nthr);
- assert(thread != NULL);
-
- push_stack(bucket);
- for (i = 0; i < nthr; i++)
- pthread_create(&thread[i], NULL, stack_thread, NULL);
-
- barrier = 1;
-
- for (i = 0; i < nthr; i++)
- pthread_join(thread[i], NULL);
-
- barrier = 0;
-
- push_stack(bucket);
- for (i = 0; i < nthr; i++)
- pthread_create(&thread[i], NULL, stack_thread, NULL);
-
- common_gettimeofday(&stv, NULL);
- barrier = 1;
- for (i = 0; i < nthr; i++)
- pthread_join(thread[i], NULL);
- common_gettimeofday(&etv, NULL);
-
- stack_assert();
-#ifdef _WIN32
- printf("%3llu %.6f\n", nthr, TVTOD(etv) - TVTOD(stv));
-#else
- printf("%3llu %.6lf\n", nthr, TVTOD(etv) - TVTOD(stv));
-#endif
- return 0;
-}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_stack/validate/push.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_stack/validate/push.c b/lib/ck/regressions/ck_stack/validate/push.c
deleted file mode 100644
index f07b86c..0000000
--- a/lib/ck/regressions/ck_stack/validate/push.c
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * Copyright 2009-2014 Samy Al Bahra.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <assert.h>
-#include <ck_pr.h>
-#ifdef SPINLOCK
-#include <ck_spinlock.h>
-#endif
-#include <ck_stack.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <pthread.h>
-#include <sys/time.h>
-#include <unistd.h>
-
-#include "../../common.h"
-
-#ifndef ITEMS
-#define ITEMS (5765760 * 2)
-#endif
-
-#define TVTOD(tv) ((tv).tv_sec+((tv).tv_usec / (double)1000000))
-
-struct entry {
- int value;
-#ifdef SPINLOCK
- struct entry *next;
-#else
- ck_stack_entry_t next;
-#endif
-};
-
-#ifdef SPINLOCK
-static struct entry *stack CK_CC_CACHELINE;
-#else
-static ck_stack_t stack CK_CC_CACHELINE;
-#endif
-
-CK_STACK_CONTAINER(struct entry, next, getvalue)
-
-static struct affinity affinerator = AFFINITY_INITIALIZER;
-static unsigned long long nthr;
-static volatile unsigned int barrier = 0;
-static unsigned int critical;
-
-#if defined(SPINLOCK)
-ck_spinlock_fas_t stack_spinlock = CK_SPINLOCK_FAS_INITIALIZER;
-#define UNLOCK ck_spinlock_fas_unlock
-#if defined(EB)
-#define LOCK ck_spinlock_fas_lock_eb
-#else
-#define LOCK ck_spinlock_fas_lock
-#endif
-#elif defined(PTHREAD)
-pthread_mutex_t stack_spinlock = PTHREAD_MUTEX_INITIALIZER;
-#define LOCK pthread_mutex_lock
-#define UNLOCK pthread_mutex_unlock
-#endif
-
-static void *
-stack_thread(void *buffer)
-{
- struct entry *bucket = buffer;
- unsigned long long i, n = ITEMS / nthr;
- unsigned int seed;
- int j;
-
- if (aff_iterate(&affinerator)) {
- perror("ERROR: failed to affine thread");
- exit(EXIT_FAILURE);
- }
-
- while (barrier == 0);
-
- for (i = 0; i < n; i++) {
- bucket[i].value = (i + 1) * 2;
-
-#if defined(MPNC)
- ck_stack_push_mpnc(&stack, &bucket[i].next);
-#elif defined(MPMC)
- ck_stack_push_mpmc(&stack, &bucket[i].next);
-#elif defined(TRYMPMC)
- while (ck_stack_trypush_mpmc(&stack, &bucket[i].next) == false)
- ck_pr_stall();
-#elif defined(TRYUPMC)
- while (ck_stack_trypush_upmc(&stack, &bucket[i].next) == false)
- ck_pr_stall();
-#elif defined(UPMC)
- ck_stack_push_upmc(&stack, &bucket[i].next);
-#elif defined(SPINLOCK) || defined(PTHREADS)
- LOCK(&stack_spinlock);
- bucket[i].next = stack;
- stack = bucket + i;
- UNLOCK(&stack_spinlock);
-#else
-# error Undefined operation.
-#endif
-
- if (critical) {
- j = common_rand_r(&seed) % critical;
- while (j--)
- __asm__ __volatile__("" ::: "memory");
- }
- }
-
- return (NULL);
-}
-
-static void
-stack_assert(void)
-{
-#ifndef SPINLOCK
- ck_stack_entry_t *n;
-#endif
- struct entry *p;
- unsigned long long c = 0;
-
-#ifdef SPINLOCK
- for (p = stack; p; p = p->next)
- c++;
-#else
- CK_STACK_FOREACH(&stack, n) {
- p = getvalue(n);
- (void)((volatile struct entry *)p)->value;
- c++;
- }
-#endif
-
- assert(c == ITEMS);
- return;
-}
-
-int
-main(int argc, char *argv[])
-{
- struct entry *bucket;
- unsigned long long i, d, n;
- pthread_t *thread;
- struct timeval stv, etv;
-
- if (argc != 4) {
- ck_error("Usage: stack <threads> <delta> <critical>\n");
- }
-
- {
- char *e;
-
- nthr = strtol(argv[1], &e, 10);
- if (errno == ERANGE) {
- perror("ERROR: too many threads");
- exit(EXIT_FAILURE);
- } else if (*e != '\0') {
- ck_error("ERROR: input format is incorrect\n");
- }
-
- d = strtol(argv[2], &e, 10);
- if (errno == ERANGE) {
- perror("ERROR: delta is too large");
- exit(EXIT_FAILURE);
- } else if (*e != '\0') {
- ck_error("ERROR: input format is incorrect\n");
- }
-
- critical = strtoul(argv[3], &e, 10);
- if (errno == ERANGE) {
- perror("ERROR: critical section is too large");
- exit(EXIT_FAILURE);
- } else if (*e != '\0') {
- ck_error("ERROR: input format is incorrect\n");
- }
- }
-
- srand(getpid());
-
- affinerator.request = 0;
- affinerator.delta = d;
- n = ITEMS / nthr;
-
-#ifndef SPINLOCK
- ck_stack_init(&stack);
-#else
- stack = NULL;
-#endif
-
- bucket = malloc(sizeof(struct entry) * ITEMS);
- assert(bucket != NULL);
-
- thread = malloc(sizeof(pthread_t) * nthr);
- assert(thread != NULL);
-
- for (i = 0; i < nthr; i++)
- pthread_create(&thread[i], NULL, stack_thread, bucket + i * n);
-
- barrier = 1;
-
- for (i = 0; i < nthr; i++)
- pthread_join(thread[i], NULL);
-
- barrier = 0;
-
-#ifndef SPINLOCK
- ck_stack_init(&stack);
-#else
- stack = NULL;
-#endif
-
- for (i = 0; i < nthr; i++)
- pthread_create(&thread[i], NULL, stack_thread, bucket + i * n);
-
- common_gettimeofday(&stv, NULL);
- barrier = 1;
- for (i = 0; i < nthr; i++)
- pthread_join(thread[i], NULL);
- common_gettimeofday(&etv, NULL);
-
- stack_assert();
-#ifdef _WIN32
- printf("%3llu %.6f\n", nthr, TVTOD(etv) - TVTOD(stv));
-#else
- printf("%3llu %.6lf\n", nthr, TVTOD(etv) - TVTOD(stv));
-#endif
- return 0;
-}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_stack/validate/serial.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_stack/validate/serial.c b/lib/ck/regressions/ck_stack/validate/serial.c
deleted file mode 100644
index c4bea18..0000000
--- a/lib/ck/regressions/ck_stack/validate/serial.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright 2009-2014 Samy Al Bahra.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include <ck_stack.h>
-
-#ifndef SIZE
-#define SIZE 1024000
-#endif
-
-struct entry {
- int value;
- ck_stack_entry_t next;
-};
-
-CK_STACK_CONTAINER(struct entry, next, get_entry)
-
-#define LOOP(PUSH, POP) \
- for (i = 0; i < SIZE; i++) { \
- entries[i].value = i; \
- PUSH(stack, &entries[i].next); \
- } \
- for (i = SIZE - 1; i >= 0; i--) { \
- entry = POP(stack); \
- assert(entry); \
- assert(get_entry(entry)->value == i); \
- }
-
-static void
-serial(ck_stack_t *stack)
-{
- struct entry *entries;
- ck_stack_entry_t *entry;
- int i;
-
- ck_stack_init(stack);
-
- entries = malloc(sizeof(struct entry) * SIZE);
- assert(entries != NULL);
-
- LOOP(ck_stack_push_upmc, ck_stack_pop_upmc);
-#ifdef CK_F_STACK_POP_MPMC
- LOOP(ck_stack_push_mpmc, ck_stack_pop_mpmc);
-#endif
- LOOP(ck_stack_push_mpnc, ck_stack_pop_upmc);
- LOOP(ck_stack_push_spnc, ck_stack_pop_npsc);
-
- return;
-}
-
-int
-main(void)
-{
- ck_stack_t stack CK_CC_CACHELINE;
-
- serial(&stack);
- return (0);
-}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_swlock/benchmark/Makefile
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_swlock/benchmark/Makefile b/lib/ck/regressions/ck_swlock/benchmark/Makefile
deleted file mode 100644
index 4ec728c..0000000
--- a/lib/ck/regressions/ck_swlock/benchmark/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-.PHONY: clean distribution
-
-OBJECTS=latency throughput
-
-all: $(OBJECTS)
-
-latency: latency.c ../../../include/ck_swlock.h
- $(CC) $(CFLAGS) -o latency latency.c
-
-throughput: throughput.c ../../../include/ck_swlock.h
- $(CC) $(CFLAGS) -o throughput throughput.c
-
-clean:
- rm -rf *.dSYM *.exe *~ *.o $(OBJECTS)
-
-include ../../../build/regressions.build
-CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_swlock/benchmark/latency.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_swlock/benchmark/latency.c b/lib/ck/regressions/ck_swlock/benchmark/latency.c
deleted file mode 100644
index 7261546..0000000
--- a/lib/ck/regressions/ck_swlock/benchmark/latency.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright 2011-2014 Samy Al Bahra.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <ck_swlock.h>
-#include <inttypes.h>
-#include <stdio.h>
-
-#include "../../common.h"
-
-#define CK_F_PR_RTM
-
-#ifndef STEPS
-#define STEPS 2000000
-#endif
-
-int
-main(void)
-{
- uint64_t s_b, e_b, i;
- ck_swlock_t swlock = CK_SWLOCK_INITIALIZER;
-
- for (i = 0; i < STEPS; i++) {
- ck_swlock_write_lock(&swlock);
- ck_swlock_write_unlock(&swlock);
- }
-
- s_b = rdtsc();
- for (i = 0; i < STEPS; i++) {
- ck_swlock_write_lock(&swlock);
- ck_swlock_write_unlock(&swlock);
- }
- e_b = rdtsc();
- printf(" WRITE: swlock %15" PRIu64 "\n", (e_b - s_b) / STEPS);
-
- for (i = 0; i < STEPS; i++) {
- ck_swlock_read_lock(&swlock);
- ck_swlock_read_unlock(&swlock);
- }
-
- s_b = rdtsc();
- for (i = 0; i < STEPS; i++) {
- ck_swlock_read_lock(&swlock);
- ck_swlock_read_unlock(&swlock);
- }
- e_b = rdtsc();
- printf(" READ: swlock %15" PRIu64 "\n", (e_b - s_b) / STEPS);
-
- for (i = 0; i < STEPS; i++) {
- ck_swlock_write_latch(&swlock);
- ck_swlock_write_unlatch(&swlock);
- }
-
- s_b = rdtsc();
- for (i = 0; i < STEPS; i++) {
- ck_swlock_write_latch(&swlock);
- ck_swlock_write_unlatch(&swlock);
- }
- e_b = rdtsc();
- printf(" LATCH: swlock %15" PRIu64 "\n", (e_b - s_b) / STEPS);
-
- return 0;
-}
-
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_swlock/benchmark/throughput.c
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_swlock/benchmark/throughput.c b/lib/ck/regressions/ck_swlock/benchmark/throughput.c
deleted file mode 100644
index fa3cf1c..0000000
--- a/lib/ck/regressions/ck_swlock/benchmark/throughput.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright 2011-2014 Samy Al Bahra.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <ck_swlock.h>
-#include <inttypes.h>
-#include <pthread.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include "../../common.h"
-
-#ifndef STEPS
-#define STEPS 1000000
-#endif
-
-static int barrier;
-static int threads;
-static unsigned int flag CK_CC_CACHELINE;
-static struct {
- ck_swlock_t lock;
-} rw CK_CC_CACHELINE = {
- .lock = CK_SWLOCK_INITIALIZER
-};
-
-static struct affinity affinity;
-
-static void *
-thread_lock(void *pun)
-{
- uint64_t s_b, e_b, a, i;
- uint64_t *value = pun;
-
- if (aff_iterate(&affinity) != 0) {
- perror("ERROR: Could not affine thread");
- exit(EXIT_FAILURE);
- }
-
- ck_pr_inc_int(&barrier);
- while (ck_pr_load_int(&barrier) != threads)
- ck_pr_stall();
-
- for (i = 1, a = 0;; i++) {
- s_b = rdtsc();
- ck_swlock_read_lock(&rw.lock);
- ck_swlock_read_unlock(&rw.lock);
- ck_swlock_read_lock(&rw.lock);
- ck_swlock_read_unlock(&rw.lock);
- ck_swlock_read_lock(&rw.lock);
- ck_swlock_read_unlock(&rw.lock);
- ck_swlock_read_lock(&rw.lock);
- ck_swlock_read_unlock(&rw.lock);
- ck_swlock_read_lock(&rw.lock);
- ck_swlock_read_unlock(&rw.lock);
- ck_swlock_read_lock(&rw.lock);
- ck_swlock_read_unlock(&rw.lock);
- ck_swlock_read_lock(&rw.lock);
- ck_swlock_read_unlock(&rw.lock);
- ck_swlock_read_lock(&rw.lock);
- ck_swlock_read_unlock(&rw.lock);
- ck_swlock_read_lock(&rw.lock);
- ck_swlock_read_unlock(&rw.lock);
- ck_swlock_read_lock(&rw.lock);
- ck_swlock_read_unlock(&rw.lock);
- ck_swlock_read_lock(&rw.lock);
- ck_swlock_read_unlock(&rw.lock);
- ck_swlock_read_lock(&rw.lock);
- ck_swlock_read_unlock(&rw.lock);
- ck_swlock_read_lock(&rw.lock);
- ck_swlock_read_unlock(&rw.lock);
- ck_swlock_read_lock(&rw.lock);
- ck_swlock_read_unlock(&rw.lock);
- ck_swlock_read_lock(&rw.lock);
- ck_swlock_read_unlock(&rw.lock);
- ck_swlock_read_lock(&rw.lock);
- ck_swlock_read_unlock(&rw.lock);
- e_b = rdtsc();
-
- a += (e_b - s_b) >> 4;
-
- if (ck_pr_load_uint(&flag) == 1)
- break;
- }
-
- ck_pr_inc_int(&barrier);
- while (ck_pr_load_int(&barrier) != threads * 2)
- ck_pr_stall();
-
- *value = (a / i);
- return NULL;
-}
-
-static void
-swlock_test(pthread_t *p, int d, uint64_t *latency, void *(*f)(void *), const char *label)
-{
- int t;
-
- ck_pr_store_int(&barrier, 0);
- ck_pr_store_uint(&flag, 0);
-
- affinity.delta = d;
- affinity.request = 0;
-
- fprintf(stderr, "Creating threads (%s)...", label);
- for (t = 0; t < threads; t++) {
- if (pthread_create(&p[t], NULL, f, latency + t) != 0) {
- ck_error("ERROR: Could not create thread %d\n", t);
- }
- }
- fprintf(stderr, "done\n");
-
- common_sleep(10);
- ck_pr_store_uint(&flag, 1);
-
- fprintf(stderr, "Waiting for threads to finish acquisition regression...");
- for (t = 0; t < threads; t++)
- pthread_join(p[t], NULL);
- fprintf(stderr, "done\n\n");
-
- for (t = 1; t <= threads; t++)
- printf("%10u %20" PRIu64 "\n", t, latency[t - 1]);
-
- fprintf(stderr, "\n");
- return;
-}
-
-
-int
-main(int argc, char *argv[])
-{
- int d;
- pthread_t *p;
- uint64_t *latency;
-
- if (argc != 3) {
- ck_error("Usage: throughput <delta> <threads>\n");
- }
-
- threads = atoi(argv[2]);
- if (threads <= 0) {
- ck_error("ERROR: Threads must be a value > 0.\n");
- }
-
- p = malloc(sizeof(pthread_t) * threads);
- if (p == NULL) {
- ck_error("ERROR: Failed to initialize thread.\n");
- }
-
- latency = malloc(sizeof(uint64_t) * threads);
- if (latency == NULL) {
- ck_error("ERROR: Failed to create latency buffer.\n");
- }
-
- d = atoi(argv[1]);
- swlock_test(p, d, latency, thread_lock, "swlock");
-
- return 0;
-}
-
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/025a4550/lib/ck/regressions/ck_swlock/validate/Makefile
----------------------------------------------------------------------
diff --git a/lib/ck/regressions/ck_swlock/validate/Makefile b/lib/ck/regressions/ck_swlock/validate/Makefile
deleted file mode 100644
index 54d62f2..0000000
--- a/lib/ck/regressions/ck_swlock/validate/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-.PHONY: check clean distribution
-
-OBJECTS=validate
-
-all: $(OBJECTS)
-
-validate: validate.c ../../../include/ck_swlock.h
- $(CC) $(CFLAGS) -o validate validate.c
-
-check: all
- ./validate $(CORES) 1
-
-clean:
- rm -rf *.dSYM *.exe *~ *.o $(OBJECTS)
-
-include ../../../build/regressions.build
-CFLAGS+=$(PTHREAD_CFLAGS) -D_GNU_SOURCE