From 45bf74abab1b665143acbcd3d44e05793dd1b32d Mon Sep 17 00:00:00 2001 From: Burt P Date: Mon, 18 Dec 2017 21:38:10 -0600 Subject: Add cli param to format result for -b For running benchmarks from the command line, add a new param to specify the output format: -g "conf" gives a line suitable for benchmark.conf -g "shell" gives the complete "moreinfo" shell data -g "short" (or nothing) gives the bench_value string as before Signed-off-by: Burt P --- modules/benchmark.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'modules') diff --git a/modules/benchmark.c b/modules/benchmark.c index 80575cfa..ed23243b 100644 --- a/modules/benchmark.c +++ b/modules/benchmark.c @@ -712,6 +712,23 @@ static gchar *run_benchmark(gchar *name) if ((scan_callback = entries[i].scan_callback)) { scan_callback(FALSE); +#define CHK_RESULT_FORMAT(F) (params.result_format && strcmp(params.result_format, F) == 0) + + if (params.run_benchmark) { + if (CHK_RESULT_FORMAT("conf") ) { + bench_result *b = bench_result_this_machine(name, bench_results[i]); + char *temp = bench_result_benchmarkconf_line(b); + bench_result_free(b); + return temp; + } else if (CHK_RESULT_FORMAT("shell") ) { + bench_result *b = bench_result_this_machine(name, bench_results[i]); + char *temp = bench_result_more_info_complete(b); + bench_result_free(b); + return temp; + } + /* defaults to "short" which is below*/ + } + return bench_value_to_str(bench_results[i]); } } -- cgit v1.2.3