Hitoshi Mitake | 629cc35 | 2009-11-05 09:31:34 +0900 | [diff] [blame] | 1 | /* |
Hitoshi Mitake | 629cc35 | 2009-11-05 09:31:34 +0900 | [diff] [blame] | 2 | * builtin-bench.c |
| 3 | * |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 4 | * General benchmarking collections provided by perf |
Hitoshi Mitake | 629cc35 | 2009-11-05 09:31:34 +0900 | [diff] [blame] | 5 | * |
| 6 | * Copyright (C) 2009, Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp> |
Hitoshi Mitake | 629cc35 | 2009-11-05 09:31:34 +0900 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | /* |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 10 | * Available benchmark collection list: |
Hitoshi Mitake | 629cc35 | 2009-11-05 09:31:34 +0900 | [diff] [blame] | 11 | * |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 12 | * sched ... scheduler and IPC performance |
Hitoshi Mitake | 827f3b4 | 2009-11-18 00:20:09 +0900 | [diff] [blame] | 13 | * mem ... memory access performance |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 14 | * numa ... NUMA scheduling and MM performance |
Davidlohr Bueso | a043971 | 2013-12-14 20:31:55 -0800 | [diff] [blame] | 15 | * futex ... Futex performance |
Hitoshi Mitake | 629cc35 | 2009-11-05 09:31:34 +0900 | [diff] [blame] | 16 | */ |
Hitoshi Mitake | 629cc35 | 2009-11-05 09:31:34 +0900 | [diff] [blame] | 17 | #include "perf.h" |
| 18 | #include "util/util.h" |
Josh Poimboeuf | 4b6ab94 | 2015-12-15 09:39:39 -0600 | [diff] [blame] | 19 | #include <subcmd/parse-options.h> |
Hitoshi Mitake | 629cc35 | 2009-11-05 09:31:34 +0900 | [diff] [blame] | 20 | #include "builtin.h" |
| 21 | #include "bench/bench.h" |
| 22 | |
| 23 | #include <stdio.h> |
| 24 | #include <stdlib.h> |
| 25 | #include <string.h> |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 26 | #include <sys/prctl.h> |
Hitoshi Mitake | 629cc35 | 2009-11-05 09:31:34 +0900 | [diff] [blame] | 27 | |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 28 | typedef int (*bench_fn_t)(int argc, const char **argv, const char *prefix); |
| 29 | |
| 30 | struct bench { |
| 31 | const char *name; |
| 32 | const char *summary; |
| 33 | bench_fn_t fn; |
Hitoshi Mitake | 629cc35 | 2009-11-05 09:31:34 +0900 | [diff] [blame] | 34 | }; |
| 35 | |
Ingo Molnar | 89fe808 | 2013-09-30 12:07:11 +0200 | [diff] [blame] | 36 | #ifdef HAVE_LIBNUMA_SUPPORT |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 37 | static struct bench numa_benchmarks[] = { |
| 38 | { "mem", "Benchmark for NUMA workloads", bench_numa }, |
Ingo Molnar | aa254af | 2015-10-19 10:04:30 +0200 | [diff] [blame] | 39 | { "all", "Run all NUMA benchmarks", NULL }, |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 40 | { NULL, NULL, NULL } |
Ingo Molnar | 1c13f3c | 2012-12-06 13:51:59 +0100 | [diff] [blame] | 41 | }; |
Peter Hurley | 79d824e | 2013-01-27 20:51:22 -0500 | [diff] [blame] | 42 | #endif |
Ingo Molnar | 1c13f3c | 2012-12-06 13:51:59 +0100 | [diff] [blame] | 43 | |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 44 | static struct bench sched_benchmarks[] = { |
| 45 | { "messaging", "Benchmark for scheduling and IPC", bench_sched_messaging }, |
| 46 | { "pipe", "Benchmark for pipe() between two processes", bench_sched_pipe }, |
Ingo Molnar | aa254af | 2015-10-19 10:04:30 +0200 | [diff] [blame] | 47 | { "all", "Run all scheduler benchmarks", NULL }, |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 48 | { NULL, NULL, NULL } |
Hitoshi Mitake | 629cc35 | 2009-11-05 09:31:34 +0900 | [diff] [blame] | 49 | }; |
| 50 | |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 51 | static struct bench mem_benchmarks[] = { |
Ingo Molnar | 13b1fdc | 2015-10-19 10:04:26 +0200 | [diff] [blame] | 52 | { "memcpy", "Benchmark for memcpy() functions", bench_mem_memcpy }, |
| 53 | { "memset", "Benchmark for memset() functions", bench_mem_memset }, |
Ingo Molnar | aa254af | 2015-10-19 10:04:30 +0200 | [diff] [blame] | 54 | { "all", "Run all memory access benchmarks", NULL }, |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 55 | { NULL, NULL, NULL } |
Hitoshi Mitake | 827f3b4 | 2009-11-18 00:20:09 +0900 | [diff] [blame] | 56 | }; |
| 57 | |
Davidlohr Bueso | a043971 | 2013-12-14 20:31:55 -0800 | [diff] [blame] | 58 | static struct bench futex_benchmarks[] = { |
| 59 | { "hash", "Benchmark for futex hash table", bench_futex_hash }, |
Davidlohr Bueso | 27db783 | 2013-12-14 20:31:56 -0800 | [diff] [blame] | 60 | { "wake", "Benchmark for futex wake calls", bench_futex_wake }, |
Davidlohr Bueso | d65817b | 2015-05-08 11:37:59 -0700 | [diff] [blame] | 61 | { "wake-parallel", "Benchmark for parallel futex wake calls", bench_futex_wake_parallel }, |
Davidlohr Bueso | 0fb298c | 2013-12-14 20:31:57 -0800 | [diff] [blame] | 62 | { "requeue", "Benchmark for futex requeue calls", bench_futex_requeue }, |
Davidlohr Bueso | d2f3f5d | 2015-07-07 01:55:53 -0700 | [diff] [blame] | 63 | /* pi-futexes */ |
| 64 | { "lock-pi", "Benchmark for futex lock_pi calls", bench_futex_lock_pi }, |
Ingo Molnar | aa254af | 2015-10-19 10:04:30 +0200 | [diff] [blame] | 65 | { "all", "Run all futex benchmarks", NULL }, |
Davidlohr Bueso | a043971 | 2013-12-14 20:31:55 -0800 | [diff] [blame] | 66 | { NULL, NULL, NULL } |
| 67 | }; |
| 68 | |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 69 | struct collection { |
| 70 | const char *name; |
| 71 | const char *summary; |
| 72 | struct bench *benchmarks; |
Hitoshi Mitake | 629cc35 | 2009-11-05 09:31:34 +0900 | [diff] [blame] | 73 | }; |
| 74 | |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 75 | static struct collection collections[] = { |
Davidlohr Bueso | a043971 | 2013-12-14 20:31:55 -0800 | [diff] [blame] | 76 | { "sched", "Scheduler and IPC benchmarks", sched_benchmarks }, |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 77 | { "mem", "Memory access benchmarks", mem_benchmarks }, |
Ingo Molnar | 89fe808 | 2013-09-30 12:07:11 +0200 | [diff] [blame] | 78 | #ifdef HAVE_LIBNUMA_SUPPORT |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 79 | { "numa", "NUMA scheduling and MM benchmarks", numa_benchmarks }, |
Peter Hurley | 79d824e | 2013-01-27 20:51:22 -0500 | [diff] [blame] | 80 | #endif |
Davidlohr Bueso | a043971 | 2013-12-14 20:31:55 -0800 | [diff] [blame] | 81 | {"futex", "Futex stressing benchmarks", futex_benchmarks }, |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 82 | { "all", "All benchmarks", NULL }, |
| 83 | { NULL, NULL, NULL } |
Hitoshi Mitake | 629cc35 | 2009-11-05 09:31:34 +0900 | [diff] [blame] | 84 | }; |
| 85 | |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 86 | /* Iterate over all benchmark collections: */ |
| 87 | #define for_each_collection(coll) \ |
| 88 | for (coll = collections; coll->name; coll++) |
| 89 | |
| 90 | /* Iterate over all benchmarks within a collection: */ |
| 91 | #define for_each_bench(coll, bench) \ |
Patrick Palka | 6eeefcc | 2014-03-12 18:40:51 -0400 | [diff] [blame] | 92 | for (bench = coll->benchmarks; bench && bench->name; bench++) |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 93 | |
| 94 | static void dump_benchmarks(struct collection *coll) |
Hitoshi Mitake | 629cc35 | 2009-11-05 09:31:34 +0900 | [diff] [blame] | 95 | { |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 96 | struct bench *bench; |
Hitoshi Mitake | 629cc35 | 2009-11-05 09:31:34 +0900 | [diff] [blame] | 97 | |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 98 | printf("\n # List of available benchmarks for collection '%s':\n\n", coll->name); |
Hitoshi Mitake | 629cc35 | 2009-11-05 09:31:34 +0900 | [diff] [blame] | 99 | |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 100 | for_each_bench(coll, bench) |
| 101 | printf("%14s: %s\n", bench->name, bench->summary); |
Hitoshi Mitake | 629cc35 | 2009-11-05 09:31:34 +0900 | [diff] [blame] | 102 | |
| 103 | printf("\n"); |
Hitoshi Mitake | 629cc35 | 2009-11-05 09:31:34 +0900 | [diff] [blame] | 104 | } |
| 105 | |
Arnaldo Carvalho de Melo | edb7c60 | 2010-05-17 16:22:41 -0300 | [diff] [blame] | 106 | static const char *bench_format_str; |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 107 | |
| 108 | /* Output/formatting style, exported to benchmark modules: */ |
Hitoshi Mitake | 386d7e9 | 2009-11-10 08:20:00 +0900 | [diff] [blame] | 109 | int bench_format = BENCH_FORMAT_DEFAULT; |
Davidlohr Bueso | b6f0629 | 2014-06-16 11:14:19 -0700 | [diff] [blame] | 110 | unsigned int bench_repeat = 10; /* default number of times to repeat the run */ |
Hitoshi Mitake | 386d7e9 | 2009-11-10 08:20:00 +0900 | [diff] [blame] | 111 | |
| 112 | static const struct option bench_options[] = { |
Ingo Molnar | 7a46a8f | 2015-10-19 10:04:22 +0200 | [diff] [blame] | 113 | OPT_STRING('f', "format", &bench_format_str, "default|simple", "Specify the output formatting style"), |
Davidlohr Bueso | b6f0629 | 2014-06-16 11:14:19 -0700 | [diff] [blame] | 114 | OPT_UINTEGER('r', "repeat", &bench_repeat, "Specify amount of times to repeat the run"), |
Hitoshi Mitake | 386d7e9 | 2009-11-10 08:20:00 +0900 | [diff] [blame] | 115 | OPT_END() |
| 116 | }; |
| 117 | |
| 118 | static const char * const bench_usage[] = { |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 119 | "perf bench [<common options>] <collection> <benchmark> [<options>]", |
Hitoshi Mitake | 386d7e9 | 2009-11-10 08:20:00 +0900 | [diff] [blame] | 120 | NULL |
| 121 | }; |
| 122 | |
| 123 | static void print_usage(void) |
| 124 | { |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 125 | struct collection *coll; |
Hitoshi Mitake | 386d7e9 | 2009-11-10 08:20:00 +0900 | [diff] [blame] | 126 | int i; |
| 127 | |
| 128 | printf("Usage: \n"); |
| 129 | for (i = 0; bench_usage[i]; i++) |
| 130 | printf("\t%s\n", bench_usage[i]); |
| 131 | printf("\n"); |
| 132 | |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 133 | printf(" # List of all available benchmark collections:\n\n"); |
Hitoshi Mitake | 386d7e9 | 2009-11-10 08:20:00 +0900 | [diff] [blame] | 134 | |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 135 | for_each_collection(coll) |
| 136 | printf("%14s: %s\n", coll->name, coll->summary); |
Hitoshi Mitake | 386d7e9 | 2009-11-10 08:20:00 +0900 | [diff] [blame] | 137 | printf("\n"); |
| 138 | } |
| 139 | |
Arnaldo Carvalho de Melo | edb7c60 | 2010-05-17 16:22:41 -0300 | [diff] [blame] | 140 | static int bench_str2int(const char *str) |
Hitoshi Mitake | 386d7e9 | 2009-11-10 08:20:00 +0900 | [diff] [blame] | 141 | { |
| 142 | if (!str) |
| 143 | return BENCH_FORMAT_DEFAULT; |
| 144 | |
| 145 | if (!strcmp(str, BENCH_FORMAT_DEFAULT_STR)) |
| 146 | return BENCH_FORMAT_DEFAULT; |
| 147 | else if (!strcmp(str, BENCH_FORMAT_SIMPLE_STR)) |
| 148 | return BENCH_FORMAT_SIMPLE; |
| 149 | |
| 150 | return BENCH_FORMAT_UNKNOWN; |
| 151 | } |
| 152 | |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 153 | /* |
| 154 | * Run a specific benchmark but first rename the running task's ->comm[] |
| 155 | * to something meaningful: |
| 156 | */ |
| 157 | static int run_bench(const char *coll_name, const char *bench_name, bench_fn_t fn, |
| 158 | int argc, const char **argv, const char *prefix) |
Hitoshi Mitake | 2044279 | 2009-12-13 17:01:59 +0900 | [diff] [blame] | 159 | { |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 160 | int size; |
| 161 | char *name; |
| 162 | int ret; |
| 163 | |
| 164 | size = strlen(coll_name) + 1 + strlen(bench_name) + 1; |
| 165 | |
| 166 | name = zalloc(size); |
| 167 | BUG_ON(!name); |
| 168 | |
| 169 | scnprintf(name, size, "%s-%s", coll_name, bench_name); |
| 170 | |
| 171 | prctl(PR_SET_NAME, name); |
| 172 | argv[0] = name; |
| 173 | |
| 174 | ret = fn(argc, argv, prefix); |
| 175 | |
| 176 | free(name); |
| 177 | |
| 178 | return ret; |
| 179 | } |
| 180 | |
| 181 | static void run_collection(struct collection *coll) |
| 182 | { |
| 183 | struct bench *bench; |
Hitoshi Mitake | 2044279 | 2009-12-13 17:01:59 +0900 | [diff] [blame] | 184 | const char *argv[2]; |
Hitoshi Mitake | 2044279 | 2009-12-13 17:01:59 +0900 | [diff] [blame] | 185 | |
| 186 | argv[1] = NULL; |
| 187 | /* |
| 188 | * TODO: |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 189 | * |
| 190 | * Preparing preset parameters for |
Hitoshi Mitake | 2044279 | 2009-12-13 17:01:59 +0900 | [diff] [blame] | 191 | * embedded, ordinary PC, HPC, etc... |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 192 | * would be helpful. |
Hitoshi Mitake | 2044279 | 2009-12-13 17:01:59 +0900 | [diff] [blame] | 193 | */ |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 194 | for_each_bench(coll, bench) { |
| 195 | if (!bench->fn) |
| 196 | break; |
| 197 | printf("# Running %s/%s benchmark...\n", coll->name, bench->name); |
Namhyung Kim | 9b494ea | 2013-01-08 18:39:26 +0900 | [diff] [blame] | 198 | fflush(stdout); |
Hitoshi Mitake | 2044279 | 2009-12-13 17:01:59 +0900 | [diff] [blame] | 199 | |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 200 | argv[1] = bench->name; |
| 201 | run_bench(coll->name, bench->name, bench->fn, 1, argv, NULL); |
Hitoshi Mitake | 2044279 | 2009-12-13 17:01:59 +0900 | [diff] [blame] | 202 | printf("\n"); |
| 203 | } |
| 204 | } |
| 205 | |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 206 | static void run_all_collections(void) |
Hitoshi Mitake | 2044279 | 2009-12-13 17:01:59 +0900 | [diff] [blame] | 207 | { |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 208 | struct collection *coll; |
| 209 | |
| 210 | for_each_collection(coll) |
| 211 | run_collection(coll); |
Hitoshi Mitake | 2044279 | 2009-12-13 17:01:59 +0900 | [diff] [blame] | 212 | } |
| 213 | |
Irina Tirdea | 1d037ca | 2012-09-11 01:15:03 +0300 | [diff] [blame] | 214 | int cmd_bench(int argc, const char **argv, const char *prefix __maybe_unused) |
Hitoshi Mitake | 629cc35 | 2009-11-05 09:31:34 +0900 | [diff] [blame] | 215 | { |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 216 | struct collection *coll; |
| 217 | int ret = 0; |
Hitoshi Mitake | 629cc35 | 2009-11-05 09:31:34 +0900 | [diff] [blame] | 218 | |
| 219 | if (argc < 2) { |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 220 | /* No collection specified. */ |
Hitoshi Mitake | 386d7e9 | 2009-11-10 08:20:00 +0900 | [diff] [blame] | 221 | print_usage(); |
| 222 | goto end; |
| 223 | } |
Hitoshi Mitake | 629cc35 | 2009-11-05 09:31:34 +0900 | [diff] [blame] | 224 | |
Hitoshi Mitake | 386d7e9 | 2009-11-10 08:20:00 +0900 | [diff] [blame] | 225 | argc = parse_options(argc, argv, bench_options, bench_usage, |
| 226 | PARSE_OPT_STOP_AT_NON_OPTION); |
Hitoshi Mitake | 629cc35 | 2009-11-05 09:31:34 +0900 | [diff] [blame] | 227 | |
Hitoshi Mitake | 386d7e9 | 2009-11-10 08:20:00 +0900 | [diff] [blame] | 228 | bench_format = bench_str2int(bench_format_str); |
| 229 | if (bench_format == BENCH_FORMAT_UNKNOWN) { |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 230 | printf("Unknown format descriptor: '%s'\n", bench_format_str); |
Hitoshi Mitake | 386d7e9 | 2009-11-10 08:20:00 +0900 | [diff] [blame] | 231 | goto end; |
| 232 | } |
| 233 | |
Davidlohr Bueso | b6f0629 | 2014-06-16 11:14:19 -0700 | [diff] [blame] | 234 | if (bench_repeat == 0) { |
| 235 | printf("Invalid repeat option: Must specify a positive value\n"); |
| 236 | goto end; |
| 237 | } |
| 238 | |
Hitoshi Mitake | 386d7e9 | 2009-11-10 08:20:00 +0900 | [diff] [blame] | 239 | if (argc < 1) { |
| 240 | print_usage(); |
Hitoshi Mitake | 629cc35 | 2009-11-05 09:31:34 +0900 | [diff] [blame] | 241 | goto end; |
| 242 | } |
| 243 | |
Hitoshi Mitake | 2044279 | 2009-12-13 17:01:59 +0900 | [diff] [blame] | 244 | if (!strcmp(argv[0], "all")) { |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 245 | run_all_collections(); |
Hitoshi Mitake | 2044279 | 2009-12-13 17:01:59 +0900 | [diff] [blame] | 246 | goto end; |
| 247 | } |
| 248 | |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 249 | for_each_collection(coll) { |
| 250 | struct bench *bench; |
| 251 | |
| 252 | if (strcmp(coll->name, argv[0])) |
Hitoshi Mitake | 629cc35 | 2009-11-05 09:31:34 +0900 | [diff] [blame] | 253 | continue; |
| 254 | |
Hitoshi Mitake | 386d7e9 | 2009-11-10 08:20:00 +0900 | [diff] [blame] | 255 | if (argc < 2) { |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 256 | /* No bench specified. */ |
| 257 | dump_benchmarks(coll); |
Hitoshi Mitake | 629cc35 | 2009-11-05 09:31:34 +0900 | [diff] [blame] | 258 | goto end; |
| 259 | } |
| 260 | |
Hitoshi Mitake | 2044279 | 2009-12-13 17:01:59 +0900 | [diff] [blame] | 261 | if (!strcmp(argv[1], "all")) { |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 262 | run_collection(coll); |
Hitoshi Mitake | 2044279 | 2009-12-13 17:01:59 +0900 | [diff] [blame] | 263 | goto end; |
| 264 | } |
| 265 | |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 266 | for_each_bench(coll, bench) { |
| 267 | if (strcmp(bench->name, argv[1])) |
Hitoshi Mitake | 629cc35 | 2009-11-05 09:31:34 +0900 | [diff] [blame] | 268 | continue; |
| 269 | |
Hitoshi Mitake | 79e295d | 2009-11-11 00:04:00 +0900 | [diff] [blame] | 270 | if (bench_format == BENCH_FORMAT_DEFAULT) |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 271 | printf("# Running '%s/%s' benchmark:\n", coll->name, bench->name); |
Namhyung Kim | 9b494ea | 2013-01-08 18:39:26 +0900 | [diff] [blame] | 272 | fflush(stdout); |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 273 | ret = run_bench(coll->name, bench->name, bench->fn, argc-1, argv+1, prefix); |
Hitoshi Mitake | 629cc35 | 2009-11-05 09:31:34 +0900 | [diff] [blame] | 274 | goto end; |
| 275 | } |
| 276 | |
Hitoshi Mitake | 386d7e9 | 2009-11-10 08:20:00 +0900 | [diff] [blame] | 277 | if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")) { |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 278 | dump_benchmarks(coll); |
Hitoshi Mitake | 629cc35 | 2009-11-05 09:31:34 +0900 | [diff] [blame] | 279 | goto end; |
| 280 | } |
| 281 | |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 282 | printf("Unknown benchmark: '%s' for collection '%s'\n", argv[1], argv[0]); |
| 283 | ret = 1; |
Hitoshi Mitake | 629cc35 | 2009-11-05 09:31:34 +0900 | [diff] [blame] | 284 | goto end; |
| 285 | } |
| 286 | |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 287 | printf("Unknown collection: '%s'\n", argv[0]); |
| 288 | ret = 1; |
Hitoshi Mitake | 629cc35 | 2009-11-05 09:31:34 +0900 | [diff] [blame] | 289 | |
| 290 | end: |
Ingo Molnar | 4157922 | 2013-10-23 14:37:56 +0200 | [diff] [blame] | 291 | return ret; |
Hitoshi Mitake | 629cc35 | 2009-11-05 09:31:34 +0900 | [diff] [blame] | 292 | } |