aboutsummaryrefslogtreecommitdiff
path: root/modules/benchmark.c
diff options
context:
space:
mode:
authorBurt P <pburt0@gmail.com>2017-12-18 21:38:10 -0600
committerLeandro A. F. Pereira <leandro@hardinfo.org>2018-02-27 07:41:51 -0800
commit45bf74abab1b665143acbcd3d44e05793dd1b32d (patch)
treeb1c0fdbc2fe5f7623c6b4d8a22c79948203c3103 /modules/benchmark.c
parentc8785521f39c3a86454ade890018ca021272c621 (diff)
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 <pburt0@gmail.com>
Diffstat (limited to 'modules/benchmark.c')
-rw-r--r--modules/benchmark.c17
1 files changed, 17 insertions, 0 deletions
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]);
}
}