From 6410bd72614922a3831f4a87614610cd65b62da5 Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Wed, 2 Dec 2015 11:56:10 +0100 Subject: [PATCH] cpu_quota.run: more info and simpler calculations Print result error and error tolerance per test result. Use TCL commands 'format' and 'abs'to simplify calculations in the conclusion part of the run script. Ref #1805 --- repos/os/run/cpu_quota.run | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/repos/os/run/cpu_quota.run b/repos/os/run/cpu_quota.run index c031e1fa2..a6a55a201 100644 --- a/repos/os/run/cpu_quota.run +++ b/repos/os/run/cpu_quota.run @@ -140,9 +140,10 @@ set err_cnt 0 proc check_counter { name opt cnt total_cnt } { global err_cnt - set err_str "Good: " - set err 0.01 - set is 0 + set bad 0 + set class "Good: " + set tol 0.01 + set is 0 # # On X86, the timer driver uses the PIT with a maximum timeout of 54 ms. @@ -151,19 +152,22 @@ proc check_counter { name opt cnt total_cnt } { # tolerance as for ARM where the driver, once configured, can sleep for # the whole test timeout. # - if {[have_spec x86]} { set err 0.02 } + if {[have_spec x86]} { set tol 0.02 } if {[expr $total_cnt != 0]} { set is [expr double($cnt) / $total_cnt ] } - set is_pc [expr double(round($is * 100000)) / 1000] - set opt_pc [expr double(round($opt * 100000)) / 1000] + set err [expr $is - $opt] + set is_fmt [format {%0.3f} [expr $is * 100]] + set opt_fmt [format {%0.3f} [expr $opt * 100]] + set err_fmt [format {%0.3f} [expr $err * 100]] + set tol_fmt [format {%0.3f} [expr $tol * 100]] - if {[expr $is > $opt + $err || $is < $opt - $err]} { + if {[expr abs($err) > $tol]} { - set err_str "Bad: " + set class "Bad: " set err_cnt [expr $err_cnt + 1] } - puts "$err_str$name received $is_pc % CPU (goal $opt_pc %)" + puts "$class$name received $is_fmt% CPU (goal $opt_fmt% tol $tol_fmt% err $err_fmt%)" } proc check_quota { name opt_sp quota_sp opt quota } {