aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-bench.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/builtin-bench.c')
-rw-r--r--tools/perf/builtin-bench.c7
1 files changed, 7 insertions, 0 deletions
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: */
106int bench_format = BENCH_FORMAT_DEFAULT; 106int bench_format = BENCH_FORMAT_DEFAULT;
107unsigned int bench_repeat = 10; /* default number of times to repeat the run */
107 108
108static const struct option bench_options[] = { 109static 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;