diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2013-03-20 10:30:20 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2013-03-20 12:06:08 -0400 |
commit | a9e7304eb012adbc974019fba70f01ca20a38004 (patch) | |
tree | 979569b3c053cc3cd50770b1b6c04c13f12720e3 | |
parent | 4f9122668d0edd36fbf2ef683d7dafd6b77ac24f (diff) | |
download | dimension-a9e7304eb012adbc974019fba70f01ca20a38004.tar.xz |
Also benchmark cycles/increment for futures.
-rw-r--r-- | libdimension/bench/future.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/libdimension/bench/future.c b/libdimension/bench/future.c index 7b199c7..815def1 100644 --- a/libdimension/bench/future.c +++ b/libdimension/bench/future.c @@ -1,5 +1,5 @@ /************************************************************************* - * Copyright (C) 2009-2013 Tavian Barnes <tavianator@tavianator.com> * + * Copyright (C) 2013 Tavian Barnes <tavianator@tavianator.com> * * * * This file is part of The Dimension Benchmark Suite. * * * @@ -38,11 +38,22 @@ dmnsn_bench_future(void *ptr, unsigned int thread, unsigned int nthreads) static int dmnsn_bench_thread(void *ptr) { - size_t nthreads = 2*dmnsn_ncpus(); - dmnsn_future *future = (dmnsn_future *)ptr; + size_t nthreads = 2*dmnsn_ncpus(); dmnsn_future_set_total(future, nthreads*ITERATIONS); + sandglass_t sandglass; + if (sandglass_init_monotonic(&sandglass, SANDGLASS_CPUTIME) != 0) { + perror("sandglass_create()"); + return EXIT_FAILURE; + } + + /* Benchmark the increment operation. */ + sandglass_bench_fine(&sandglass, dmnsn_future_increment(future)); + printf("dmnsn_future_increment(): %ld\n", sandglass.grains); + future->progress = 0; + + /* Now run a bunch of increments concurrently. */ return dmnsn_execute_concurrently(&dmnsn_bench_future, future, nthreads); } |