From 5ac5b735b8cbc2bab60298ae93b381e88b00007f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Fri, 1 Feb 2013 17:39:20 +0100 Subject: wip-worktree-state --- .lvimrc | 2 ++ Makefile | 4 ++-- lf_fifo_test.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 72 insertions(+), 4 deletions(-) create mode 100644 .lvimrc diff --git a/.lvimrc b/.lvimrc new file mode 100644 index 0000000..caca9da --- /dev/null +++ b/.lvimrc @@ -0,0 +1,2 @@ +" +set ts=8 sw=3 sts=3 expandtab cino=>5n-3f0^-2{2(0W1st0 diff --git a/Makefile b/Makefile index e3ecd9a..52a9a1d 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ CC = gcc STD = _GNU_SOURCE -CFLAGS = -DDEBUG +CFLAGS = -DDEBUG -g BIN = cas container_of lock_free_queue_test lf_fifo_test lf_ringbuffer_test .c.o: @@ -28,7 +28,7 @@ lock_free_queue_test: lock_free_queue.o lock_free_queue_test.o lf_fifo.o: lf_fifo.h lf_fifo.c lf_cas.h lf_fifo_test.o: lf_fifo_test.c lf_fifo_test: lf_fifo.o lf_fifo_test.o - $(CC) -lpthread lf_fifo.o lf_fifo_test.o -o lf_fifo_test + $(CC) -g -lpthread lf_fifo.o lf_fifo_test.o -o lf_fifo_test lf_ringbuffer.o: lf_ringbuffer.h lf_ringbuffer.c lf_ringbuffer_data.h lf_portable_cas.h lf_ringbuffer_test.o: lf_ringbuffer_test.c lf_ringbuffer.h diff --git a/lf_fifo_test.c b/lf_fifo_test.c index 7d6a165..13ec1f5 100644 --- a/lf_fifo_test.c +++ b/lf_fifo_test.c @@ -198,10 +198,76 @@ static void run_aggressive_push_pop(int threads_n, int nodes_n) free(params); } +static void run_interlaced_push_pop(int push_threads_n, int pop_threads_n, int nodes_n) +{ + int threads_n; + uint32_t i,j; + lf_fifo_t fifo; + struct timespec start, end; + pthread_t *threads; + thread_params_t *params; + + threads_n = push_threads_n + pop_threads_n; + threads = malloc( sizeof(pthread_t)*threads_n); + if (threads==NULL) _failure("threads malloc failure"); + params = malloc( sizeof(thread_params_t)*threads_n); + if (params==NULL) _failure("params malloc failure"); + + lf_fifo_init( &fifo); + + for(i=0; i