aboutsummaryrefslogtreecommitdiff
path: root/hardinfo2/hardinfo.c
diff options
context:
space:
mode:
authorLeandro Augusto Fogolin Pereira <leandro@zorg.(none)>2009-04-12 13:23:30 -0300
committerLeandro Augusto Fogolin Pereira <leandro@zorg.(none)>2009-04-12 13:23:30 -0300
commitff38c6955526377ef92ff7aa96b3c8ecb5fdac05 (patch)
treee7cfcba16ddc360230a8084a4f1a2ce6f2349ca8 /hardinfo2/hardinfo.c
parentf456e935f74f23ae76de31d5fb84906090c8e1aa (diff)
Make it possible to run a benchmark from command-line
Diffstat (limited to 'hardinfo2/hardinfo.c')
-rw-r--r--hardinfo2/hardinfo.c18
1 files changed, 15 insertions, 3 deletions
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");