diff options
author | Davidlohr Bueso <davidlohr@hp.com> | 2014-06-16 14:14:19 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-06-19 15:13:15 -0400 |
commit | b6f0629a94f7ed6089560be7f0561be19f934fc4 (patch) | |
tree | 36dad2fd09afc6d1f4cc484e8d91b1f7e0d93ba6 | |
parent | b094c99e8e284cff839400a3b61fda1fa53962fc (diff) |
perf bench: Add --repeat option
There are a number of benchmarks that do single runs and as a result
does not really help users gain a general idea of how the workload
performs. So the user must either manually do multiple runs or just use
single bogus results.
This option will enable users to specify the amount of runs (arbitrarily
defaulted to 10, to use the existing benchmarks default) through the
'--repeat' option. Add it to perf-bench instead of implementing it
always in each specific benchmark.
Signed-off-by: Davidlohr Bueso <davidlohr@hp.com>
Cc: Aswin Chandramouleeswaran <aswin@hp.com>
Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
Cc: Jiri Olsa <jolsa@kernel.org>
Link: http://lkml.kernel.org/r/1402942467-10671-2-git-send-email-davidlohr@hp.com
[ Kept the existing default of 10, changing it to something else should
be done on separate patch ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/Documentation/perf-bench.txt | 4 | ||||
-rw-r--r-- | tools/perf/bench/bench.h | 1 | ||||
-rw-r--r-- | tools/perf/builtin-bench.c | 7 |
3 files changed, 12 insertions, 0 deletions
diff --git a/tools/perf/Documentation/perf-bench.txt b/tools/perf/Documentation/perf-bench.txt index 4464ad770d51..f6480cbf309b 100644 --- a/tools/perf/Documentation/perf-bench.txt +++ b/tools/perf/Documentation/perf-bench.txt | |||
@@ -16,6 +16,10 @@ This 'perf bench' command is a general framework for benchmark suites. | |||
16 | 16 | ||
17 | COMMON OPTIONS | 17 | COMMON OPTIONS |
18 | -------------- | 18 | -------------- |
19 | -r:: | ||
20 | --repeat=:: | ||
21 | Specify amount of times to repeat the run (default 10). | ||
22 | |||
19 | -f:: | 23 | -f:: |
20 | --format=:: | 24 | --format=:: |
21 | Specify format style. | 25 | Specify format style. |
diff --git a/tools/perf/bench/bench.h b/tools/perf/bench/bench.h index eba46709b279..3c4dd44d45cb 100644 --- a/tools/perf/bench/bench.h +++ b/tools/perf/bench/bench.h | |||
@@ -43,5 +43,6 @@ extern int bench_futex_requeue(int argc, const char **argv, const char *prefix); | |||
43 | #define BENCH_FORMAT_UNKNOWN -1 | 43 | #define BENCH_FORMAT_UNKNOWN -1 |
44 | 44 | ||
45 | extern int bench_format; | 45 | extern int bench_format; |
46 | extern unsigned int bench_repeat; | ||
46 | 47 | ||
47 | #endif | 48 | #endif |
diff --git a/tools/perf/builtin-bench.c b/tools/perf/builtin-bench.c index 1e6e77710545..b9a56fa83330 100644 --- a/tools/perf/builtin-bench.c +++ b/tools/perf/builtin-bench.c | |||
@@ -104,9 +104,11 @@ static const char *bench_format_str; | |||
104 | 104 | ||
105 | /* Output/formatting style, exported to benchmark modules: */ | 105 | /* Output/formatting style, exported to benchmark modules: */ |
106 | int bench_format = BENCH_FORMAT_DEFAULT; | 106 | int bench_format = BENCH_FORMAT_DEFAULT; |
107 | unsigned int bench_repeat = 10; /* default number of times to repeat the run */ | ||
107 | 108 | ||
108 | static const struct option bench_options[] = { | 109 | static const struct option bench_options[] = { |
109 | OPT_STRING('f', "format", &bench_format_str, "default", "Specify format style"), | 110 | OPT_STRING('f', "format", &bench_format_str, "default", "Specify format style"), |
111 | OPT_UINTEGER('r', "repeat", &bench_repeat, "Specify amount of times to repeat the run"), | ||
110 | OPT_END() | 112 | OPT_END() |
111 | }; | 113 | }; |
112 | 114 | ||
@@ -226,6 +228,11 @@ int cmd_bench(int argc, const char **argv, const char *prefix __maybe_unused) | |||
226 | goto end; | 228 | goto end; |
227 | } | 229 | } |
228 | 230 | ||
231 | if (bench_repeat == 0) { | ||
232 | printf("Invalid repeat option: Must specify a positive value\n"); | ||
233 | goto end; | ||
234 | } | ||
235 | |||
229 | if (argc < 1) { | 236 | if (argc < 1) { |
230 | print_usage(); | 237 | print_usage(); |
231 | goto end; | 238 | goto end; |