Patchwork [2/8] cpu: cpufreq: make progress estimate more accurate

login
register
mail settings
Submitter Colin King
Date July 23, 2012, 1:02 p.m.
Message ID <1343048578-13332-3-git-send-email-colin.king@canonical.com>
Download mbox | patch
Permalink /patch/172661/
State Accepted
Headers show

Comments

Colin King - July 23, 2012, 1:02 p.m.
From: Colin Ian King <colin.king@canonical.com>

The progress estimate was based on a poorly judged "time" based
estimate.  Fix this to base the progress estimate on the total
number of tests.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/cpu/cpufreq/cpufreq.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
Keng-Yu Lin - July 25, 2012, 7:26 a.m.
On Mon, Jul 23, 2012 at 9:02 PM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The progress estimate was based on a poorly judged "time" based
> estimate.  Fix this to base the progress estimate on the total
> number of tests.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/cpu/cpufreq/cpufreq.c |    9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c
> index a141812..02506cb 100644
> --- a/src/cpu/cpufreq/cpufreq.c
> +++ b/src/cpu/cpufreq/cpufreq.c
> @@ -304,7 +304,7 @@ static void do_cpu(fwts_framework *fw, int cpu)
>                         topspeed = freqs[i].speed;
>
>                 performedtests++;
> -               fwts_progress(fw, (75 * performedtests)/totaltests);
> +               fwts_progress(fw, 100*performedtests/totaltests);
>
>                 i++;
>                 c = c2;
> @@ -576,7 +576,7 @@ static void check_sw_any(fwts_framework *fw)
>
>                 high_perf = get_performance(i);
>                 performedtests++;
> -               fwts_progress(fw, (75 * performedtests)/totaltests);
> +               fwts_progress(fw, 100*performedtests/totaltests);
>                 /*
>                  * now set all the others to low again; sw_any will cause
>                  * the core in question to now also get the low speed, while
> @@ -594,7 +594,7 @@ static void check_sw_any(fwts_framework *fw)
>                         lowest_speed(fw, i);
>                 }
>                 performedtests++;
> -               fwts_progress(fw, (75 * performedtests)/totaltests);
> +               fwts_progress(fw, 100*performedtests/totaltests);
>         }
>         if (!once)
>                 fwts_passed(fw, "P-state coordination done by Hardware.");
> @@ -667,10 +667,13 @@ static int cpufreq_test1(fwts_framework *fw)
>         if (sysconf(_SC_NPROCESSORS_CONF) > 1 && nrspeeds > 1) {
>                 do_sw_all_test(fw);
>                 performedtests++;
> +               fwts_progress(fw, 100*performedtests/totaltests);
>                 do_sw_any_test(fw);
>                 performedtests++;
> +               fwts_progress(fw, 100*performedtests/totaltests);
>         } else if (nrspeeds > 1) {
>                 performedtests += 2;
> +               fwts_progress(fw, 100*performedtests/totaltests);
>         }
>
>         fwts_progress(fw, 100);
> --
> 1.7.10.4
>
Acked-by: Keng-Yu Lin <kengyu@canonical.com>
Ivan Hu - July 25, 2012, 8:01 a.m.
On 07/23/2012 09:02 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The progress estimate was based on a poorly judged "time" based
> estimate.  Fix this to base the progress estimate on the total
> number of tests.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/cpu/cpufreq/cpufreq.c |    9 ++++++---
>   1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c
> index a141812..02506cb 100644
> --- a/src/cpu/cpufreq/cpufreq.c
> +++ b/src/cpu/cpufreq/cpufreq.c
> @@ -304,7 +304,7 @@ static void do_cpu(fwts_framework *fw, int cpu)
>   			topspeed = freqs[i].speed;
>
>   		performedtests++;
> -		fwts_progress(fw, (75 * performedtests)/totaltests);
> +		fwts_progress(fw, 100*performedtests/totaltests);
>
>   		i++;
>   		c = c2;
> @@ -576,7 +576,7 @@ static void check_sw_any(fwts_framework *fw)
>
>   		high_perf = get_performance(i);
>   		performedtests++;
> -		fwts_progress(fw, (75 * performedtests)/totaltests);
> +		fwts_progress(fw, 100*performedtests/totaltests);
>   		/*
>   		 * now set all the others to low again; sw_any will cause
>   		 * the core in question to now also get the low speed, while
> @@ -594,7 +594,7 @@ static void check_sw_any(fwts_framework *fw)
>   			lowest_speed(fw, i);
>   		}
>   		performedtests++;
> -		fwts_progress(fw, (75 * performedtests)/totaltests);
> +		fwts_progress(fw, 100*performedtests/totaltests);
>   	}
>   	if (!once)
>   		fwts_passed(fw, "P-state coordination done by Hardware.");
> @@ -667,10 +667,13 @@ static int cpufreq_test1(fwts_framework *fw)
>   	if (sysconf(_SC_NPROCESSORS_CONF) > 1 && nrspeeds > 1) {
>   		do_sw_all_test(fw);
>   		performedtests++;
> +		fwts_progress(fw, 100*performedtests/totaltests);
>   		do_sw_any_test(fw);
>   		performedtests++;
> +		fwts_progress(fw, 100*performedtests/totaltests);
>   	} else if (nrspeeds > 1) {
>   		performedtests += 2;
> +		fwts_progress(fw, 100*performedtests/totaltests);
>   	}
>
>   	fwts_progress(fw, 100);
>

Acked-by: Ivan Hu <ivan.hu@canonical.com>

Patch

diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c
index a141812..02506cb 100644
--- a/src/cpu/cpufreq/cpufreq.c
+++ b/src/cpu/cpufreq/cpufreq.c
@@ -304,7 +304,7 @@  static void do_cpu(fwts_framework *fw, int cpu)
 			topspeed = freqs[i].speed;
 
 		performedtests++;
-		fwts_progress(fw, (75 * performedtests)/totaltests);
+		fwts_progress(fw, 100*performedtests/totaltests);
 
 		i++;
 		c = c2;
@@ -576,7 +576,7 @@  static void check_sw_any(fwts_framework *fw)
 
 		high_perf = get_performance(i);
 		performedtests++;
-		fwts_progress(fw, (75 * performedtests)/totaltests);
+		fwts_progress(fw, 100*performedtests/totaltests);
 		/*
 		 * now set all the others to low again; sw_any will cause
 		 * the core in question to now also get the low speed, while
@@ -594,7 +594,7 @@  static void check_sw_any(fwts_framework *fw)
 			lowest_speed(fw, i);
 		}
 		performedtests++;
-		fwts_progress(fw, (75 * performedtests)/totaltests);
+		fwts_progress(fw, 100*performedtests/totaltests);
 	}
 	if (!once)
 		fwts_passed(fw, "P-state coordination done by Hardware.");
@@ -667,10 +667,13 @@  static int cpufreq_test1(fwts_framework *fw)
 	if (sysconf(_SC_NPROCESSORS_CONF) > 1 && nrspeeds > 1) {
 		do_sw_all_test(fw);
 		performedtests++;
+		fwts_progress(fw, 100*performedtests/totaltests);
 		do_sw_any_test(fw);
 		performedtests++;
+		fwts_progress(fw, 100*performedtests/totaltests);
 	} else if (nrspeeds > 1) {
 		performedtests += 2;
+		fwts_progress(fw, 100*performedtests/totaltests);
 	}
 
 	fwts_progress(fw, 100);