ACK: [PATCH 10/11] fwts: scale cpu benchmark results to one second
Alex Hung
alex.hung at canonical.com
Tue Jun 2 03:28:12 UTC 2015
On 05/21/2015 05:34 PM, Jeremy Kerr wrote:
> Signed-off-by: Jeremy Kerr <jk at ozlabs.org>
>
> ---
> src/lib/src/fwts_cpu.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/src/lib/src/fwts_cpu.c b/src/lib/src/fwts_cpu.c
> index 743de63..d7793b7 100644
> --- a/src/lib/src/fwts_cpu.c
> +++ b/src/lib/src/fwts_cpu.c
> @@ -378,6 +378,7 @@ int fwts_cpu_benchmark(
> fwts_cpu_benchmark_result tmp;
> cpu_set_t mask, oldset;
> int perfctr, ncpus, rc;
> + double duration_sec;
> static bool warned;
> bool perf_ok;
>
> @@ -445,12 +446,15 @@ int fwts_cpu_benchmark(
> return FWTS_ERROR;
> }
>
> + duration_sec = duration.tv_sec +
> + ((1.0 * duration.tv_usec) / 1000000.0);
> +
> + tmp.loops = (1.0 * tmp.loops) / duration_sec;
> +
> if (perf_ok) {
> rc = perf_read_counter(perfctr, &perfctr_result);
> if (rc == FWTS_OK) {
> - tmp.cycles = perfctr_result /
> - ((1.0 * duration.tv_usec / 1000000) +
> - duration.tv_sec);
> + tmp.cycles = (1.0 * perfctr_result) / duration_sec;
> tmp.cycles_valid = true;
> } else {
> fwts_log_warning(fw, "failed to read perf counters");
>
Acked-by: Alex Hung <alex.hung at canonical.com>
More information about the fwts-devel
mailing list