From ed8e1c491cc7c25a2517d41c60ca78adfe523ddd Mon Sep 17 00:00:00 2001 From: Leandro Pereira Date: Tue, 2 Feb 2021 08:31:22 -0800 Subject: Remove the ability to load benchmarks.conf Now that the sync manager is working fine, and we have the same data in a structured way in JSON files, reading from this legacy format doesn't need to be supported any longer. --- modules/benchmark/bench_results.c | 155 -------------------------------------- 1 file changed, 155 deletions(-) (limited to 'modules/benchmark') diff --git a/modules/benchmark/bench_results.c b/modules/benchmark/bench_results.c index cd8cc6e8..40345aa5 100644 --- a/modules/benchmark/bench_results.c +++ b/modules/benchmark/bench_results.c @@ -379,161 +379,6 @@ bench_result *bench_result_benchmarkjson(const gchar *bench_name, return b; } -bench_result * -bench_result_benchmarkconf(const char *section, const char *key, char **values) -{ - bench_result *b = NULL; - char *s0, *s1, *s2; - int nx = 0, vl = 0; - float n, m; - - vl = g_strv_length(values); - - b = malloc(sizeof(bench_result)); - if (b) { - memset(b, 0, sizeof(bench_result)); - b->machine = bench_machine_new(); - b->name = strdup(section); - - if (vl >= 10) { /* the 11th could be empty */ - b->machine->mid = strdup(key); - /* first try as bench_value, then try as double 'result' only */ - b->bvalue = bench_value_from_str(values[0]); - if (b->bvalue.result == -1) - b->bvalue.result = atoi(values[0]); - b->bvalue.threads_used = atoi(values[1]); - b->machine->board = strdup(values[2]); - b->machine->cpu_name = strdup(values[3]); - b->machine->cpu_desc = strdup(values[4]); - b->machine->cpu_config = strdup(values[5]); - b->machine->memory_kiB = strtoull(values[6], NULL, 10); - b->machine->processors = atoi(values[7]); - b->machine->cores = atoi(values[8]); - b->machine->threads = atoi(values[9]); - if (vl >= 11) - b->machine->ogl_renderer = strdup(values[10]); - if (vl >= 12) - b->machine->gpu_desc = strdup(values[11]); - if (vl >= 13) - b->machine->machine_data_version = atoi(values[12]); - if (vl >= 14) - b->machine->ptr_bits = atoi(values[13]); - if (vl >= 15) - b->machine->is_su_data = atoi(values[14]); - if (vl >= 16) - b->machine->memory_phys_MiB = strtoull(values[15], NULL, 10); - if (vl >= 17) - b->machine->ram_types = strdup(values[16]); - b->legacy = 0; - } else if (vl >= 2) { - b->bvalue.result = atof(values[0]); - b->legacy = 1; - - /* old old format has prefix before cpu name (ex: 4x Pentium...) */ - nx = nx_prefix(key); - if (nx > 0) { - b->machine->cpu_name = strdup(strchr(key, 'x') + 1); - b->machine->threads = nx; - } else { - b->machine->cpu_name = strdup(key); - b->machine->threads = 1; - } - - b->machine->cpu_config = strdup(values[1]); - /* new old format has cpu_config string with nx prefix */ - nx = nx_prefix(values[1]); - if (nx > 0) { - b->machine->threads = nx; - } - - b->bvalue.threads_used = - guess_threads_old_result(section, b->machine->threads); - - /* If the clock rate in the id string is more than the - * config string, use that. Older hardinfo used current cpu freq - * instead of max freq. - * "...@ 2.00GHz" -> 2000.0 */ - s0 = b->machine->cpu_name; - s2 = strstr(s0, "Hz"); - if (s2 && s2 > s0 + 2) { - m = 1; /* assume M */ - if (*(s2 - 1) == 'G') - m = 1000; - s1 = s2 - 2; - while (s1 > s0) { - if (!(isdigit(*s1) || *s1 == '.' || *s1 == ' ')) - break; - s1--; - } - - if (s1 > s0) { - n = atof(s1 + 1); - n *= m; - - s1 = g_strdup_printf("%dx %.2f %s", b->bvalue.threads_used, - n, _("MHz")); - if (cpu_config_cmp(b->machine->cpu_config, s1) == -1 && - !cpu_config_is_close(b->machine->cpu_config, s1)) { - free(b->machine->cpu_config); - b->machine->cpu_config = s1; - } else { - free(s1); - } - } - } - - /* old results only give threads */ - b->machine->processors = -1; - b->machine->cores = -1; - - /* clean the old result's CPU model name if it was probably an x86 */ - if (cpu_name_needs_cleanup(b->machine->cpu_name)) - nice_name_x86_cpuid_model_string(b->machine->cpu_name); - } - - b->machine->cpu_config = - cpu_config_retranslate(b->machine->cpu_config, 0, 1); - if (b->machine->board != NULL && strlen(b->machine->board) == 0) { - free(b->machine->board); - b->machine->board = NULL; - } - if (b->machine->cpu_desc != NULL && strlen(b->machine->cpu_desc) == 0) { - free(b->machine->cpu_desc); - b->machine->cpu_desc = NULL; - } - gen_machine_id(b->machine); - } - return b; -} - -char *bench_result_benchmarkconf_line(bench_result *b) -{ - char *cpu_config = cpu_config_retranslate(b->machine->cpu_config, 1, 0); - char *bv = bench_value_to_str(b->bvalue); - -#define prep_str(s) \ - (s ? (char *)auto_free(gg_key_file_parse_string_as_value(s, '|')) : "") - char *ret = g_strdup_printf( - "%s=%s|%d|%s|%s|%s|%s|%" PRId64 "|%d|%d|%d|%s|%s|%d|%d|%d|%" PRId64 - "|%s\n", - b->machine->mid, bv, b->bvalue.threads_used, - prep_str(b->machine->board), prep_str(b->machine->cpu_name), - prep_str(b->machine->cpu_desc), prep_str(cpu_config), - b->machine->memory_kiB, b->machine->processors, b->machine->cores, - b->machine->threads, prep_str(b->machine->ogl_renderer), - prep_str(b->machine->gpu_desc), - b->machine->machine_data_version, // [12] - b->machine->ptr_bits, // [13] - b->machine->is_su_data, // [14] - b->machine->memory_phys_MiB, // [15] - b->machine->ram_types // [16] - ); - - free(cpu_config); - free(bv); - return ret; -} - static char *bench_result_more_info_less(bench_result *b) { char *memory = NULL; -- cgit v1.2.3