diff mbox

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

Message ID 1343048578-13332-3-git-send-email-colin.king@canonical.com
State Accepted
Headers show

Commit Message

Colin Ian King July 23, 2012, 1:02 p.m. UTC
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(-)

Comments

Keng-Yu Lin July 25, 2012, 7:26 a.m. UTC | #1
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. UTC | #2
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>
diff mbox

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);