|
18 | 18 | #include <stdlib.h> |
19 | 19 | #include <linux/compiler.h> |
20 | 20 | #include <linux/kernel.h> |
| 21 | +#include <linux/prctl.h> |
21 | 22 | #include <linux/zalloc.h> |
22 | 23 | #include <sys/time.h> |
23 | 24 | #include <sys/mman.h> |
| 25 | +#include <sys/prctl.h> |
24 | 26 | #include <perf/cpumap.h> |
25 | 27 |
|
26 | 28 | #include "../util/mutex.h" |
@@ -50,9 +52,12 @@ struct worker { |
50 | 52 | static struct bench_futex_parameters params = { |
51 | 53 | .nfutexes = 1024, |
52 | 54 | .runtime = 10, |
| 55 | + .nbuckets = -1, |
53 | 56 | }; |
54 | 57 |
|
55 | 58 | static const struct option options[] = { |
| 59 | + OPT_INTEGER( 'b', "buckets", ¶ms.nbuckets, "Specify amount of hash buckets"), |
| 60 | + OPT_BOOLEAN( 'I', "immutable", ¶ms.buckets_immutable, "Make the hash buckets immutable"), |
56 | 61 | OPT_UINTEGER('t', "threads", ¶ms.nthreads, "Specify amount of threads"), |
57 | 62 | OPT_UINTEGER('r', "runtime", ¶ms.runtime, "Specify runtime (in seconds)"), |
58 | 63 | OPT_UINTEGER('f', "futexes", ¶ms.nfutexes, "Specify amount of futexes per threads"), |
@@ -118,6 +123,7 @@ static void print_summary(void) |
118 | 123 | printf("%sAveraged %ld operations/sec (+- %.2f%%), total secs = %d\n", |
119 | 124 | !params.silent ? "\n" : "", avg, rel_stddev_stats(stddev, avg), |
120 | 125 | (int)bench__runtime.tv_sec); |
| 126 | + futex_print_nbuckets(¶ms); |
121 | 127 | } |
122 | 128 |
|
123 | 129 | int bench_futex_hash(int argc, const char **argv) |
@@ -161,6 +167,7 @@ int bench_futex_hash(int argc, const char **argv) |
161 | 167 |
|
162 | 168 | if (!params.fshared) |
163 | 169 | futex_flag = FUTEX_PRIVATE_FLAG; |
| 170 | + futex_set_nbuckets_param(¶ms); |
164 | 171 |
|
165 | 172 | printf("Run summary [PID %d]: %d threads, each operating on %d [%s] futexes for %d secs.\n\n", |
166 | 173 | getpid(), params.nthreads, params.nfutexes, params.fshared ? "shared":"private", params.runtime); |
|
0 commit comments