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

Keng-Yu Lin kengyu at canonical.com
Wed Jul 25 07:26:59 UTC 2012


On Mon, Jul 23, 2012 at 9:02 PM, Colin King <colin.king at canonical.com> wrote:
> From: Colin Ian King <colin.king at 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 at 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 at canonical.com>



More information about the fwts-devel mailing list