From 45c23f525667f963acefc9114c79a9a28d5ab1a9 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 10 Jan 2017 23:00:05 +0000 Subject: correct output of total resp. average values considering net execution time (overhead considered) --- tests-perf/clock.perf.tcl | 54 +++++++++++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/tests-perf/clock.perf.tcl b/tests-perf/clock.perf.tcl index 7b522d0..16664b2 100644 --- a/tests-perf/clock.perf.tcl +++ b/tests-perf/clock.perf.tcl @@ -46,48 +46,62 @@ proc _test_get_commands {lst} { proc _test_out_total {} { upvar _ _ - if {![llength $_(ittm)]} { + set tcnt [llength $_(itm)] + if {!$tcnt} { puts "" return } set mintm 0x7fffffff set maxtm 0 + set nett 0 + set wtm 0 + set wcnt 0 set i 0 - foreach tm $_(ittm) { + foreach tm $_(itm) { + if {[llength $tm] > 6} { + set nett [expr {$nett + [lindex $tm 6]}] + } + set wtm [expr {$wtm + [lindex $tm 0]}] + set wcnt [expr {$wcnt + [lindex $tm 2]}] + set tm [lindex $tm 0] if {$tm > $maxtm} {set maxtm $tm; set maxi $i} if {$tm < $mintm} {set mintm $tm; set mini $i} incr i } puts [string repeat ** 40] - puts [format "Total %d cases in %.2f sec.:" [llength $_(itcnt)] [expr {[llength $_(itcnt)] * $_(reptime) / 1000.0}]] - lset _(m) 0 [format %.6f [expr [join $_(ittm) +]]] - lset _(m) 2 [expr [join $_(itcnt) +]] - lset _(m) 4 [format %.3f [expr {[lindex $_(m) 2] / ([llength $_(itcnt)] * $_(reptime) / 1000.0)}]] + set s [format "%d cases in %.2f sec." $tcnt [expr {$tcnt * $_(reptime) / 1000.0}]] + if {$nett > 0} { + append s [format " (%.2f nett-sec.)" [expr {$nett / 1000.0}]] + } + puts "Total $s:" + lset _(m) 0 [format %.6f $wtm] + lset _(m) 2 $wcnt + lset _(m) 4 [format %.3f [expr {$wcnt / (($nett ? $nett : ($tcnt * $_(reptime))) / 1000.0)}]] + if {[llength $_(m)] > 6} { + lset _(m) 6 [format %.3f $nett] + } puts $_(m) puts "Average:" - lset _(m) 0 [format %.6f [expr {[lindex $_(m) 0] / [llength $_(itcnt)]}]] - lset _(m) 2 [expr {[lindex $_(m) 2] / [llength $_(itcnt)]}] - lset _(m) 4 [expr {[lindex $_(m) 2] * (1000 / $_(reptime))}] + lset _(m) 0 [format %.6f [expr {[lindex $_(m) 0] / $tcnt}]] + lset _(m) 2 [expr {[lindex $_(m) 2] / $tcnt}] + if {[llength $_(m)] > 6} { + lset _(m) 6 [format %.3f [expr {[lindex $_(m) 6] / $tcnt}]] + lset _(m) 4 [format %.0f [expr {[lindex $_(m) 2] / [lindex $_(m) 6] * 1000}]] + } puts $_(m) puts "Min:" - lset _(m) 0 [lindex $_(ittm) $mini] - lset _(m) 2 [lindex $_(itcnt) $mini] - lset _(m) 2 [lindex $_(itrate) $mini] - puts $_(m) + puts [lindex $_(itm) $mini] puts "Max:" - lset _(m) 0 [lindex $_(ittm) $maxi] - lset _(m) 2 [lindex $_(itcnt) $maxi] - lset _(m) 2 [lindex $_(itrate) $maxi] - puts $_(m) + puts [lindex $_(itm) $maxi] puts [string repeat ** 40] puts "" } proc _test_run {reptime lst {outcmd {puts $_(r)}}} { upvar _ _ - array set _ [list ittm {} itcnt {} itrate {} reptime $reptime] + array set _ [list itm {} reptime $reptime] foreach _(c) [_test_get_commands $lst] { puts "% [regsub -all {\n[ \t]*} $_(c) {; }]" @@ -99,9 +113,7 @@ proc _test_run {reptime lst {outcmd {puts $_(r)}}} { set _(r) [if 1 $_(c)] if {$outcmd ne {}} $outcmd puts [set _(m) [timerate $_(c) $reptime]] - lappend _(ittm) [lindex $_(m) 0] - lappend _(itcnt) [lindex $_(m) 2] - lappend _(itrate) [lindex $_(m) 4] + lappend _(itm) $_(m) puts "" } _test_out_total -- cgit v0.12