diff options
| author | Jérémy Zurcher <jeremy@asynk.ch> | 2013-02-01 15:17:33 +0100 | 
|---|---|---|
| committer | Jérémy Zurcher <jeremy@asynk.ch> | 2013-02-01 15:17:33 +0100 | 
| commit | 049947ab267a06fdb55003a9294d6c358f2ee7de (patch) | |
| tree | aa0f3d4e43029116d24c8097b5e6a208a0056273 | |
| parent | 3e68cf92ed7c9eeba4df08228bda9284856ad0da (diff) | |
| download | lock_free-049947ab267a06fdb55003a9294d6c358f2ee7de.zip lock_free-049947ab267a06fdb55003a9294d6c358f2ee7de.tar.gz  | |
fifo test: add per thread push count check
| -rw-r--r-- | lf_fifo_test.c | 11 | 
1 files changed, 8 insertions, 3 deletions
diff --git a/lf_fifo_test.c b/lf_fifo_test.c index 1a9d5c0..0b41aec 100644 --- a/lf_fifo_test.c +++ b/lf_fifo_test.c @@ -67,8 +67,8 @@ static uint64_t time_diff(struct timespec *t0, struct timespec *t1)  static void report( char* op, uint32_t threads, uint32_t nodes, uint64_t dt)  {     uint32_t n = threads*nodes; -   fprintf(stdout," - %s: %3d threads * %6d op in %4d [ms] : %7d [us] : %10d [ns]\t -> %6d [ns/op]\n", -            op, threads, nodes, (int)(dt/1000000), (int)(dt/1000), (int)dt, (int)(dt/n)); +   fprintf(stdout," - %s: %3d threads * %6d op in %4u [ms] : %7u [us] : %10u [ns]\t -> %6d [ns/op]\n", +            op, threads, nodes, (unsigned int)(dt/1000000), (unsigned int)(dt/1000), (unsigned int)dt, (int)(dt/n));  }  static uint32_t fifo_length(lf_fifo_t *fifo) @@ -102,6 +102,7 @@ void* aggressive_push( void* param )          nodes[i].data = i+1;          lf_fifo_push(fifo,&nodes[i].link);       } +   params->n = i;     return NULL;  } @@ -126,7 +127,7 @@ void* aggressive_pop( void* param )     return NULL;  } -static void run_aggressive_push_pop(uint32_t threads_n, uint32_t nodes_n) +static void run_aggressive_push_pop(int threads_n, int nodes_n)  {     uint32_t i, j;     lf_fifo_t fifo; @@ -161,6 +162,10 @@ static void run_aggressive_push_pop(uint32_t threads_n, uint32_t nodes_n)     report( "aggressive push", threads_n, nodes_n, time_diff( &start, &end ));     _check((fifo_length(&fifo)==(threads_n*nodes_n)),"fifo length failure after aggressive push"); +   for(i=0; i<threads_n; i++) +     { +        _check((params[i].n==nodes_n),"push n failure after aggressive push"); +     }     clock_gettime(CLOCK_MONOTONIC, &start);     for(i=0; i<threads_n; i++)  | 
