diff options
author | Burt P <pburt0@gmail.com> | 2017-08-15 02:32:23 -0500 |
---|---|---|
committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2017-08-21 05:47:00 -0700 |
commit | 431d86000fb1491ca15eeab6f9bd027c6a75f477 (patch) | |
tree | 424bf3d352f0daf6702551c32b350fa5baa82943 /modules | |
parent | c83636f963c6fdc1dcf6bd62107b3ed4a3fd6244 (diff) |
Add OpenGL Renderer to benchmark result details
For the GPU Drawing benchmark at least, it should give
some idea of the graphics capabilities of the machine.
This is the only data hardinfo currently has about that.
Maybe in the future, more advanced GPU information could
be given.
Signed-off-by: Burt P <pburt0@gmail.com>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/benchmark/bench_results.c | 20 | ||||
-rw-r--r-- | modules/computer.c | 8 |
2 files changed, 23 insertions, 5 deletions
diff --git a/modules/benchmark/bench_results.c b/modules/benchmark/bench_results.c index d9d8f8ae..4c7b3dca 100644 --- a/modules/benchmark/bench_results.c +++ b/modules/benchmark/bench_results.c @@ -24,6 +24,7 @@ typedef struct { char *cpu_name; char *cpu_desc; char *cpu_config; + char *ogl_renderer; int threads; char *mid; } simple_machine; @@ -146,6 +147,7 @@ simple_machine *simple_machine_this() { m->cpu_name = module_call_method("devices::getProcessorName"); m->cpu_desc = module_call_method("devices::getProcessorDesc"); m->cpu_config = module_call_method("devices::getProcessorFrequencyDesc"); + m->ogl_renderer = module_call_method("computer::getOGLRenderer"); tmp = module_call_method("devices::getMemoryTotal"); m->memory_kiB = atoi(tmp); free(tmp); @@ -222,7 +224,7 @@ bench_result *bench_result_benchmarkconf(const char *section, const char *key, c b->machine = simple_machine_new(); b->name = strdup(section); - if (vl >= 8) { + if (vl >= 8) { /* the 9th could be empty */ b->machine->mid = strdup(key); b->result = atof(values[0]); b->threads = atoi(values[1]); @@ -232,6 +234,8 @@ bench_result *bench_result_benchmarkconf(const char *section, const char *key, c b->machine->cpu_config = strdup(values[5]); b->machine->memory_kiB = atoi(values[6]); b->machine->threads = atoi(values[7]); + if (vl >= 9) + b->machine->ogl_renderer = strdup(values[8]); b->legacy = 0; } else if (vl >= 2) { b->result = atof(values[0]); @@ -305,13 +309,15 @@ bench_result *bench_result_benchmarkconf(const char *section, const char *key, c char *bench_result_benchmarkconf_line(bench_result *b) { char *cpu_config = cpu_config_retranslate(b->machine->cpu_config, 1, 0); - char *ret = g_strdup_printf("%s=%.2f|%d|%s|%s|%s|%s|%d|%d\n", + char *ret = g_strdup_printf("%s=%.2f|%d|%s|%s|%s|%s|%d|%d|%s\n", b->machine->mid, b->result, b->threads, (b->machine->board != NULL) ? b->machine->board : "", b->machine->cpu_name, (b->machine->cpu_desc != NULL) ? b->machine->cpu_desc : "", cpu_config, - b->machine->memory_kiB, b->machine->threads ); + b->machine->memory_kiB, b->machine->threads, + (b->machine->ogl_renderer != NULL) ? b->machine->ogl_renderer : "" + ); free(cpu_config); return ret; } @@ -326,6 +332,7 @@ char *bench_result_more_info(bench_result *b) { /* cpudesc */ "%s=%s\n" /* cpucfg */ "%s=%s\n" /* threads */ "%s=%d\n" + /* ogl rend */ "%s=%s\n" /* mem */ "%s=%d %s\n", _("Benchmark Result"), _("Threads"), b->threads, @@ -337,6 +344,7 @@ char *bench_result_more_info(bench_result *b) { _("CPU Description"), (b->machine->cpu_desc != NULL) ? b->machine->cpu_desc : _("(Unknown)"), _("CPU Config"), b->machine->cpu_config, _("Threads Available"), b->machine->threads, + _("OpenGL Renderer"), (b->machine->ogl_renderer != NULL) ? b->machine->ogl_renderer : _("(Unknown)"), _("Memory"), b->machine->memory_kiB, _("kiB") ); } @@ -353,6 +361,7 @@ char *bench_result_more_info_complete(bench_result *b) { /* cpudesc */ "%s=%s\n" /* cpucfg */ "%s=%s\n" /* threads */ "%s=%d\n" + /* ogl rend */ "%s=%s\n" /* mem */ "%s=%d %s\n" "[%s]\n" /* mid */ "%s=%s\n" @@ -364,11 +373,12 @@ char *bench_result_more_info_complete(bench_result *b) { b->legacy ? _("Note") : "#Note", b->legacy ? _("This result is from an old version of Hardinfo.") : "", _("Machine"), - _("Board"), b->machine->board, + _("Board"), (b->machine->board != NULL) ? b->machine->board : _("(Unknown)"), _("CPU Name"), b->machine->cpu_name, - _("CPU Description"), b->machine->cpu_desc, + _("CPU Description"), (b->machine->cpu_desc != NULL) ? b->machine->cpu_desc : _("(Unknown)"), _("CPU Config"), b->machine->cpu_config, _("Threads Available"), b->machine->threads, + _("OpenGL Renderer"), (b->machine->ogl_renderer != NULL) ? b->machine->ogl_renderer : _("(Unknown)"), _("Memory"), b->machine->memory_kiB, _("kiB"), _("Handles"), _("mid"), b->machine->mid, diff --git a/modules/computer.c b/modules/computer.c index 513d94f5..8c4e4345 100644 --- a/modules/computer.c +++ b/modules/computer.c @@ -645,6 +645,13 @@ gchar *get_os(void) return g_strdup(computer->os->distro); } +gchar *get_ogl_renderer(void) +{ + scan_display(FALSE); + + return g_strdup(computer->display->ogl_renderer); +} + gchar *get_display_summary(void) { scan_display(FALSE); @@ -689,6 +696,7 @@ ShellModuleMethod *hi_exported_methods(void) {"getOSKernel", get_os_kernel}, {"getOS", get_os}, {"getDisplaySummary", get_display_summary}, + {"getOGLRenderer", get_ogl_renderer}, {"getAudioCards", get_audio_cards}, {"getKernelModuleDescription", get_kernel_module_description}, {NULL} |