ACK: [PATCH] cpufreq: the calibration is taking a long time, make it faster
ivanhu
ivan.hu at canonical.com
Tue Oct 13 03:18:07 UTC 2015
On 2015年10月07日 23:53, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> I've reduced the CPU cycle consumer loop from 1 sec to 0.25 seconds,
> it speeds up the cpufreq test and I've not notice any detrimental
> results occur. If one reduces the loop down to sub 0.1 seconds
> the results aren't that stable, so I think 0.25 seconds is a good
> compromise.
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
> src/cpu/cpufreq/cpufreq.c | 9 +++++----
> src/lib/src/fwts_cpu.c | 2 +-
> 2 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c
> index c96ed4d..c202797 100644
> --- a/src/cpu/cpufreq/cpufreq.c
> +++ b/src/cpu/cpufreq/cpufreq.c
> @@ -74,6 +74,7 @@ static bool cpufreq_settable = true;
>
> #define MAX_ABSOLUTE_ERROR 20.0 /* In Hz */
> #define MAX_RELATIVE_ERROR 0.0025 /* as fraction */
> +#define MAX_REPEATS (5)
>
> static inline void cpu_mkpath(
> char *const path,
> @@ -130,8 +131,8 @@ static int cpu_set_frequency(fwts_framework *fw, struct cpu *cpu,
>
> out:
> if (rc != FWTS_OK)
> - fwts_warning(fw, "Cannot set CPU %d frequency to %s.",
> - cpu->idx, buffer);
> + fwts_warning(fw, "Cannot set CPU %d frequency to %s when setting %s.",
> + cpu->idx, buffer, path);
> return rc;
> }
>
> @@ -446,14 +447,14 @@ static int cpufreq_test_sw_all(fwts_framework *fw)
> for (i = 0; i < num_cpus; i++)
> cpu_set_lowest_frequency(fw, &cpus[i]);
>
> - if (get_performance_repeat(fw, &cpus[0], 5, GET_PERFORMANCE_MIN, &lowperf) != FWTS_OK) {
> + if (get_performance_repeat(fw, &cpus[0], MAX_REPEATS, GET_PERFORMANCE_MIN, &lowperf) != FWTS_OK) {
> fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqSW_ALLGetPerf",
> "Failed to get CPU performance.");
> return FWTS_ERROR;
> }
>
> cpu_set_highest_frequency(fw, &cpus[0]);
> - if (get_performance_repeat(fw, &cpus[0], 5, GET_PERFORMANCE_MAX, &highperf) != FWTS_OK) {
> + if (get_performance_repeat(fw, &cpus[0], MAX_REPEATS, GET_PERFORMANCE_MAX, &highperf) != FWTS_OK) {
> fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqSW_ALLGetPerf",
> "Failed to get CPU performance.");
> return FWTS_ERROR;
> diff --git a/src/lib/src/fwts_cpu.c b/src/lib/src/fwts_cpu.c
> index a870ae8..307e81b 100644
> --- a/src/lib/src/fwts_cpu.c
> +++ b/src/lib/src/fwts_cpu.c
> @@ -433,7 +433,7 @@ int fwts_cpu_benchmark(
>
> gettimeofday(&end, NULL);
> timersub(&end, &start, &duration);
> - if (duration.tv_sec >= 1)
> + if (duration.tv_usec >= 250000)
> break;
> }
>
>
Acked-by: Ivan Hu <ivan.hu at canonical.com>
More information about the fwts-devel
mailing list