From patchwork Mon Jul 23 13:02:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 172668 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 35DB82C0354 for ; Mon, 23 Jul 2012 23:03:09 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1StII0-0001AQ-1W for incoming@patchwork.ozlabs.org; Mon, 23 Jul 2012 13:03:08 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1StIHs-000192-Do for fwts-devel@lists.ubuntu.com; Mon, 23 Jul 2012 13:03:00 +0000 Received: from cpc37-craw6-2-0-cust191.16-3.cable.virginmedia.com ([92.239.39.192] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1StIHs-0005p5-AK for fwts-devel@lists.ubuntu.com; Mon, 23 Jul 2012 13:03:00 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH 4/8] cpu: cpufreq: rename some global variables to make them more readable Date: Mon, 23 Jul 2012 14:02:54 +0100 Message-Id: <1343048578-13332-5-git-send-email-colin.king@canonical.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1343048578-13332-1-git-send-email-colin.king@canonical.com> References: <1343048578-13332-1-git-send-email-colin.king@canonical.com> X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: fwts-devel-bounces@lists.ubuntu.com Errors-To: fwts-devel-bounces@lists.ubuntu.com From: Colin Ian King Signed-off-by: Colin Ian King Acked-by: Keng-Yu Lin Acked-by: Ivan Hu --- src/cpu/cpufreq/cpufreq.c | 66 ++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c index 7c93473..a2c0975 100644 --- a/src/cpu/cpufreq/cpufreq.c +++ b/src/cpu/cpufreq/cpufreq.c @@ -45,11 +45,11 @@ typedef struct { unsigned long speed; } fwts_cpu_freq; -static int nrspeeds = -1; -static int totaltests = 1; -static int performedtests = 0; +static int number_of_speeds = -1; +static int total_tests = 1; +static int performed_tests = 0; static int no_cpufreq = 0; -static unsigned long topspeed = 0; +static unsigned long top_speed = 0; #define GET_PERFORMANCE_MAX (0) #define GET_PERFORMANCE_MIN (1) @@ -265,7 +265,7 @@ static void do_cpu(fwts_framework *fw, int cpu) int speedcount; static int warned=0; int warned_PSS = 0; - unsigned long cpu_topspeed = 0; + unsigned long cpu_top_speed = 0; memset(freqs, 0, sizeof(freqs)); memset(line, 0, 4096); @@ -284,8 +284,8 @@ static void do_cpu(fwts_framework *fw, int cpu) return; fclose(file); - if (totaltests==1) - totaltests = (2+count_ints(line)) * + if (total_tests==1) + total_tests = (2+count_ints(line)) * sysconf(_SC_NPROCESSORS_CONF) + 2; c = line; @@ -301,32 +301,32 @@ static void do_cpu(fwts_framework *fw, int cpu) freqs[i].Hz = strtoull(c, NULL, 10); set_HZ(fw, cpu, freqs[i].Hz); freqs[i].speed = get_performance(cpu); - if (freqs[i].speed > cpu_topspeed) - cpu_topspeed = freqs[i].speed; + if (freqs[i].speed > cpu_top_speed) + cpu_top_speed = freqs[i].speed; - performedtests++; - fwts_progress(fw, 100*performedtests/totaltests); + performed_tests++; + fwts_progress(fw, 100*performed_tests/total_tests); i++; c = c2; } speedcount = i; - if (cpu_topspeed > topspeed) - topspeed = cpu_topspeed; + if (cpu_top_speed > top_speed) + top_speed = cpu_top_speed; fwts_log_info(fw, "CPU %d: %i CPU frequency steps supported.", cpu, speedcount); fwts_log_info_verbatum(fw, " Frequency | Relative Speed | Bogo loops"); fwts_log_info_verbatum(fw, "-----------+----------------+-----------"); for (i=0; i < speedcount; i++) - fwts_log_info_verbatum(fw, "%9s | %5.1f %% | %9lu", HzToHuman(freqs[i].Hz), 100.0*freqs[i].speed/cpu_topspeed, freqs[i].speed); + fwts_log_info_verbatum(fw, "%9s | %5.1f %% | %9lu", HzToHuman(freqs[i].Hz), 100.0*freqs[i].speed/cpu_top_speed, freqs[i].speed); - if (nrspeeds == -1) - nrspeeds = speedcount; + if (number_of_speeds == -1) + number_of_speeds = speedcount; fwts_log_nl(fw); - if (nrspeeds != speedcount) + if (number_of_speeds != speedcount) fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqPStates", "Not all processors support the same number of P states."); @@ -469,12 +469,12 @@ static void do_sw_all_test(fwts_framework *fw) lowperf = 100 * get_performance_repeat(fw, first_cpu_index, 0, 5, - GET_PERFORMANCE_MIN) / topspeed; + GET_PERFORMANCE_MIN) / top_speed; highest_speed(fw, first_cpu_index); highperf = 100 * get_performance_repeat(fw, first_cpu_index, 0, 5, - GET_PERFORMANCE_MAX) / topspeed; + GET_PERFORMANCE_MAX) / top_speed; if (lowperf >= highperf) fwts_failed(fw, LOG_LEVEL_MEDIUM, @@ -520,7 +520,7 @@ static void do_sw_any_test(fwts_framework *fw) lowperf = 100 * get_performance_repeat(fw, first_cpu_index, 0, 5, - GET_PERFORMANCE_MIN) / topspeed; + GET_PERFORMANCE_MIN) / top_speed; highest_speed(fw, first_cpu_index); @@ -537,7 +537,7 @@ static void do_sw_any_test(fwts_framework *fw) highperf = 100 * get_performance_repeat(fw, first_cpu_index, 0, 5, - GET_PERFORMANCE_MAX) / topspeed; + GET_PERFORMANCE_MAX) / top_speed; if (lowperf >= highperf) fwts_failed(fw, LOG_LEVEL_MEDIUM, @@ -584,8 +584,8 @@ static void check_sw_any(fwts_framework *fw) continue; high_perf = get_performance(i); - performedtests++; - fwts_progress(fw, 100*performedtests/totaltests); + performed_tests++; + fwts_progress(fw, 100*performed_tests/total_tests); /* * now set all the others to low again; sw_any will cause * the core in question to now also get the low speed, while @@ -602,8 +602,8 @@ static void check_sw_any(fwts_framework *fw) once++; lowest_speed(fw, i); } - performedtests++; - fwts_progress(fw, 100*performedtests/totaltests); + performed_tests++; + fwts_progress(fw, 100*performed_tests/total_tests); } if (!once) fwts_passed(fw, "P-state coordination done by Hardware."); @@ -673,16 +673,16 @@ static int cpufreq_test1(fwts_framework *fw) * Check for more than one CPU and more than one frequency and * then do the benchmark set 2 */ - if (sysconf(_SC_NPROCESSORS_CONF) > 1 && nrspeeds > 1) { + if (sysconf(_SC_NPROCESSORS_CONF) > 1 && number_of_speeds > 1) { do_sw_all_test(fw); - performedtests++; - fwts_progress(fw, 100*performedtests/totaltests); + performed_tests++; + fwts_progress(fw, 100*performed_tests/total_tests); do_sw_any_test(fw); - performedtests++; - fwts_progress(fw, 100*performedtests/totaltests); - } else if (nrspeeds > 1) { - performedtests += 2; - fwts_progress(fw, 100*performedtests/totaltests); + performed_tests++; + fwts_progress(fw, 100*performed_tests/total_tests); + } else if (number_of_speeds > 1) { + performed_tests += 2; + fwts_progress(fw, 100*performed_tests/total_tests); } fwts_progress(fw, 100);