From ff38c6955526377ef92ff7aa96b3c8ecb5fdac05 Mon Sep 17 00:00:00 2001 From: Leandro Augusto Fogolin Pereira Date: Sun, 12 Apr 2009 13:23:30 -0300 Subject: Make it possible to run a benchmark from command-line --- hardinfo2/hardinfo.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'hardinfo2/hardinfo.c') diff --git a/hardinfo2/hardinfo.c b/hardinfo2/hardinfo.c index 651a39e0..3f638a87 100644 --- a/hardinfo2/hardinfo.c +++ b/hardinfo2/hardinfo.c @@ -90,7 +90,7 @@ int main(int argc, char **argv) return 0; } - if (!params.create_report) { + if (!params.create_report && !params.run_benchmark) { /* we only try to open the UI if the user didn't asked for a report. */ params.gui_running = ui_init(&argc, &argv); @@ -113,8 +113,18 @@ int main(int argc, char **argv) /* initialize vendor database */ vendor_init(); - - if (params.gui_running) { + + if (params.run_benchmark) { + gchar *result; + + result = module_call_method_param("benchmark::runBenchmark", params.run_benchmark); + if (!result) { + g_error("Unknown benchmark ``%s'' or benchmark.so not loaded", params.run_benchmark); + } else { + g_print("Benchmark result: %s\n", result); + g_free(result); + } + } else if (params.gui_running) { /* initialize gui and start gtk+ main loop */ icon_cache_init(); stock_icons_init(); @@ -136,6 +146,8 @@ int main(int argc, char **argv) g_print("%s", report); g_free(report); + } else { + g_error("Don't know what to do. Exiting."); } DEBUG("finished"); -- cgit v1.2.3