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 --- hardinfo/hardinfo.c | 1 + hardinfo/util.c | 8 ++++++++ 2 files changed, 9 insertions(+) (limited to 'hardinfo') diff --git a/hardinfo/hardinfo.c b/hardinfo/hardinfo.c index 4401a551..3c0ade11 100644 --- a/hardinfo/hardinfo.c +++ b/hardinfo/hardinfo.c @@ -123,6 +123,7 @@ int main(int argc, char **argv) if (!result) { g_error(_("Unknown benchmark ``%s'' or libbenchmark.so not loaded"), params.run_benchmark); } else { + fprintf(stderr, "\n"); g_print("%s\n", result); g_free(result); } diff --git a/hardinfo/util.c b/hardinfo/util.c index efa19b9c..7bcc5dd5 100644 --- a/hardinfo/util.c +++ b/hardinfo/util.c @@ -390,6 +390,7 @@ void parameters_init(int *argc, char ***argv, ProgramParameters * param) static gboolean run_xmlrpc_server = FALSE; static gchar *report_format = NULL; static gchar *run_benchmark = NULL; + static gchar *result_format = NULL; static gchar **use_modules = NULL; static GOptionEntry options[] = { @@ -411,6 +412,12 @@ void parameters_init(int *argc, char ***argv, ProgramParameters * param) .arg = G_OPTION_ARG_STRING, .arg_data = &run_benchmark, .description = N_("run benchmark; requires benchmark.so to be loaded")}, + { + .long_name = "result-format", + .short_name = 'g', + .arg = G_OPTION_ARG_STRING, + .arg_data = &result_format, + .description = N_("benchmark result format ([short], conf, shell)")}, { .long_name = "list-modules", .short_name = 'l', @@ -468,6 +475,7 @@ void parameters_init(int *argc, char ***argv, ProgramParameters * param) param->list_modules = list_modules; param->use_modules = use_modules; param->run_benchmark = run_benchmark; + param->result_format = result_format; param->autoload_deps = autoload_deps; param->run_xmlrpc_server = run_xmlrpc_server; param->argv0 = *(argv)[0]; -- cgit v1.2.3