From 726b9bf46a6130a86be57c9d1bd4d7b975c5f09d Mon Sep 17 00:00:00 2001 From: Burt P Date: Mon, 14 Aug 2017 01:37:27 -0500 Subject: bench_results: fix cpu clock from id string Old versions of hardinfo used current frequency instead of max frequency. If the cpu id string had a clock rate in it, and it is significantly more than thre reported frequency in the benchmark result, use that. This feature exists in an earlier commit but it was broken. Signed-off-by: Burt P --- modules/benchmark/bench_results.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'modules/benchmark/bench_results.c') diff --git a/modules/benchmark/bench_results.c b/modules/benchmark/bench_results.c index cef26e73..57cb56ea 100644 --- a/modules/benchmark/bench_results.c +++ b/modules/benchmark/bench_results.c @@ -96,7 +96,6 @@ static gen_machine_id(simple_machine *m) { } } - simple_machine *simple_machine_new() { simple_machine *m = NULL; m = malloc(sizeof(simple_machine)); @@ -161,7 +160,7 @@ bench_result *bench_result_this_machine(const char *bench_name, float result, in static int nx_prefix(const char *str) { char *s, *x; if (str != NULL) { - s = str; + s = (char*)str; x = strchr(str, 'x'); if (x && x-s >= 1) { while(s != x) { @@ -231,18 +230,18 @@ bench_result *bench_result_benchmarkconf(const char *section, const char *key, c * "...@ 2.00GHz" -> 2000.0 */ s0 = b->machine->cpu_name; s2 = strstr(s0, "Hz"); - if (s2 && s2 != s0) { - s1 = s2 - 1; + 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 == ' ') + if (!( isdigit(*s1) || *s1 == '.' || *s1 == ' ')) break; s1--; } if (s1 > s0) { - m = 0; /* assume M */ - if (*(s2-1) == 'G') - m = 1000; n = atof(s1+1); n *= m; -- cgit v1.2.3