diff options
| author | Leandro Augusto Fogolin Pereira <leandro@zorg.(none)> | 2009-04-12 13:23:30 -0300 | 
|---|---|---|
| committer | Leandro Augusto Fogolin Pereira <leandro@zorg.(none)> | 2009-04-12 13:23:30 -0300 | 
| commit | ff38c6955526377ef92ff7aa96b3c8ecb5fdac05 (patch) | |
| tree | e7cfcba16ddc360230a8084a4f1a2ce6f2349ca8 /hardinfo2/util.c | |
| parent | f456e935f74f23ae76de31d5fb84906090c8e1aa (diff) | |
Make it possible to run a benchmark from command-line
Diffstat (limited to 'hardinfo2/util.c')
| -rw-r--r-- | hardinfo2/util.c | 14 | 
1 files changed, 10 insertions, 4 deletions
diff --git a/hardinfo2/util.c b/hardinfo2/util.c index 266ce4eb..ac2ad3b5 100644 --- a/hardinfo2/util.c +++ b/hardinfo2/util.c @@ -364,6 +364,7 @@ void parameters_init(int *argc, char ***argv, ProgramParameters * param)      static gboolean list_modules = FALSE;      static gboolean autoload_deps = FALSE;      static gchar *report_format = NULL; +    static gchar *run_benchmark = NULL;      static gchar **use_modules = NULL;      static GOptionEntry options[] = { @@ -380,6 +381,12 @@ void parameters_init(int *argc, char ***argv, ProgramParameters * param)  	 .arg_data = &report_format,  	 .description = "chooses a report format (text, html)"},  	{ +	 .long_name = "run-benchmark", +	 .short_name = 'b', +	 .arg = G_OPTION_ARG_STRING, +	 .arg_data = &run_benchmark, +	 .description = "run benchmark; requires benchmark.so to be loaded"}, +	{  	 .long_name = "list-modules",  	 .short_name = 'l',  	 .arg = G_OPTION_ARG_NONE, @@ -427,6 +434,7 @@ void parameters_init(int *argc, char ***argv, ProgramParameters * param)      param->show_version = show_version;      param->list_modules = list_modules;      param->use_modules = use_modules; +    param->run_benchmark = run_benchmark;      param->autoload_deps = autoload_deps;      param->argv0 = *(argv)[0]; @@ -534,8 +542,7 @@ gchar *module_call_method(gchar * method)      }      function = g_hash_table_lookup(__module_methods, method); -    return function ? g_strdup(function()) : -	g_strdup_printf("{Unknown method: \"%s\"}", method); +    return function ? g_strdup(function()) : NULL;  }  /* FIXME: varargs? */ @@ -548,8 +555,7 @@ gchar *module_call_method_param(gchar * method, gchar * parameter)      }      function = g_hash_table_lookup(__module_methods, method); -    return function ? g_strdup(function(parameter)) : -	g_strdup_printf("{Unknown method: \"%s\"}", method); +    return function ? g_strdup(function(parameter)) : NULL;  }  static ShellModule *module_load(gchar * filename)  | 
