From f614001f33c72f3df3acaf07477da855f7c17014 Mon Sep 17 00:00:00 2001 From: Vladimir Weinstein Date: Wed, 18 Dec 2002 08:41:00 +0000 Subject: [PATCH] ICU-2508 fixes to the output format X-SVN-Rev: 10726 --- icu4c/source/test/perf/perldriver/Format.pm | 2 +- icu4c/source/test/perf/perldriver/Output.pm | 201 +++++++++++++------- 2 files changed, 130 insertions(+), 73 deletions(-) diff --git a/icu4c/source/test/perf/perldriver/Format.pm b/icu4c/source/test/perf/perldriver/Format.pm index ba619de2907..d12fd18ad25 100644 --- a/icu4c/source/test/perf/perldriver/Format.pm +++ b/icu4c/source/test/perf/perldriver/Format.pm @@ -118,7 +118,7 @@ sub formatPercent { my $a = shift; my $delta = shift; # may be undef - formatNumber($sigdig, 100, $a, $delta) . ' %'; + formatNumber($sigdig, 100, $a, $delta) . '%'; } #--------------------------------------------------------------------- diff --git a/icu4c/source/test/perf/perldriver/Output.pm b/icu4c/source/test/perf/perldriver/Output.pm index 2a616277a0d..7b67a9c337b 100644 --- a/icu4c/source/test/perf/perldriver/Output.pm +++ b/icu4c/source/test/perf/perldriver/Output.pm @@ -44,58 +44,90 @@ sub printLeg { } } +sub outputDist { + my $value = shift; + my $percent = shift; + my $mean = $value->getMean; + my $error = $value->getError; + print HTML " 0) { + print HTML "value"; + } else { + print HTML "worse"; + } + print HTML "\">"; + if($percent) { + print HTML formatPercent(2, $mean); + } else { + print HTML formatNumber(2, $mult, $mean); + } + print HTML "\n"; + print HTML "±"; + if($percent) { + print HTML formatPercent(2, $error); + } else { + print HTML formatNumber(2, $mult, $error); + } + print HTML "\n"; +} + +sub outputValue { + my $value = shift; + print HTML ""; + print HTML $value; + #print HTML formatNumber(2, 1, $value); + print HTML "\n"; +} + sub startTable { #my $printEvents = shift; $inTable = 1; my $i; - print HTML ""; print HTML "\n"; + print HTML "\n"; if($#headers >= 0) { my ($header, $i); - print HTML ""; - print HTML ""; - print HTML ""; - printLeg("Test Name - name of the test as set by the test writer", "Ops - number of ".$operationIs."s per iteration"); + print HTML "\n"; + print HTML "\n"; + print HTML "\n"; + printLeg("TestName - name of the test as set by the test writer\n", "Ops - number of ".$operationIs."s per iteration\n"); + if(!$printEvents) { + print HTML "\n"; + } else { + print HTML "\n"; + print HTML "\n"; + } + print HTML "\n\n"; if(!$printEvents) { foreach $header (@headers) { - print HTML ""; - print HTML ""; - printLeg("$header mean/op - mean time for $header per $operationIs"); - printLeg("$header error/op - error range for mean time"); + print HTML "\n"; + printLeg("$header /op - mean time and error for $header per $operationIs"); } } for $i (1 .. $#headers) { - print HTML ""; - print HTML ""; - printLeg("ratio $i mean/op - ratio of per $operationIs time, calculated as: (($headers[0] - $headers[$i])/$headers[$i])*100%, mean value"); - printLeg("ratio $i error/op - error range of the above value"); + print HTML "\n"; + printLeg("ratio $i /op - ratio and error of per $operationIs time, calculated as: (($headers[0] - $headers[$i])/$headers[$i])*100%, mean value"); } if($printEvents) { foreach $header (@headers) { - print HTML ""; - printLeg("$header events - number of ".$eventIs."s for $header per iteration"); + print HTML "\n"; + printLeg("$header events - number of ".$eventIs."s for $header per iteration"); } foreach $header (@headers) { - print HTML ""; - print HTML ""; - printLeg("$header
/ev
\n"; + printLeg("$header /ev - mean time and error for $header per $eventIs"); } for $i (1 .. $#headers) { - print HTML ""; - print HTML ""; - printLeg("ratio $i mean/ev - ratio of per $eventIs time, calculated as: (($headers[0] - $headers[$i])/$headers[$i])*100%, mean value"); - printLeg("ratio $i error/ev - error range of the above value"); + print HTML "\n"; + printLeg("ratio $i /ev - ratio and error of per $eventIs time, calculated as: (($headers[0] - $headers[$i])/$headers[$i])*100%, mean value"); } } - - - -# foreach $i (@timetypes) { -# foreach $header (@headers) { -# print HTML "" unless ($i =~ /event/ && !$printEvents); -# } -# } print HTML "\n"; } $legendDone = 1; @@ -105,8 +137,8 @@ sub closeTable { if($inTable) { undef $inTable; print HTML "\n"; + print HTML ""; print HTML "
Test NameOps
Test NameOpsPer OperationPer OperationPer Event
$header
mean/op
$header
error/op
$header
/op
ratio $i
mean/op
ratio $i
error/op
ratio $i
/op
$header
events
$header
events
$header
mean/ev
$header
error/ev
ratio $i
mean/ev
ratio $i
error/ev
ratio $i
/ev
$header
$i
\n"; - print HTML "
"; } } @@ -165,25 +197,41 @@ sub setupOutput { if($options{ "outputDir" }) { $html = $options{ "outputDir" }."/".$html; } + $html =~ s/ /_/g; open(HTML,">$html") or die "Can't write to $html: $!"; +# print HTML < + $title - ---> - + EOF print HTML "

$title

\n"; @@ -198,7 +246,7 @@ sub closeOutput { } $legend .= "\n"; print HTML $legend; - printRaw(); + outputRaw(); print HTML < @@ -208,7 +256,7 @@ EOF } -sub printRaw { +sub outputRaw { print HTML "

Raw data

"; my $key; my $i; @@ -217,42 +265,51 @@ sub printRaw { print HTML "\n"; for $key (sort keys %raw) { my $printkey = $key; - $printkey =~ s/\/ /; + $printkey =~ s/\/ /g; if($printEvents) { - print HTML "\n"; # locale and data file - print HTML "\n"; + if($key ne "") { + print HTML "\n"; # locale and data file + } + print HTML "\n"; } else { - print HTML "\n"; # locale and data file - print HTML "\n"; + if($key ne "") { + print HTML "\n"; # locale and data file + } + print HTML "\n"; } + $printkey =~ s/[\<\>\/ ]//g; - + my %done; for $i ( $raw{$key} ) { print HTML ""; for $j ( @$i ) { my ($test, $args); ($test, $args) = split(/,/, shift(@$j)); - print HTML ""; - print HTML ""; + + print HTML ""; + + print HTML ""; - #print HTML ""; - print HTML ""; - print HTML ""; + print HTML ""; + print HTML ""; + my @data = @{ shift(@$j) }; -# for $k (@data) { -# print HTML "$k, "; -# } my $ds = Dataset->new(@data); - print HTML ""; + print HTML ""; if($#{ $j } >= 0) { - print HTML ""; + print HTML ""; } print HTML "\n"; } } -# print HTML "
\n"; } -# print %raw; } sub store { @@ -271,30 +328,32 @@ sub outputRow { } if(!$inTable) { if(@noevents) { - debug("Have events header\n"); $printEvents = 1; startTable; } else { - debug("No events header\n"); startTable; } } debug("No events: @noevents, $#noevents\n"); my $j; + my $loc = $current; + $loc =~ s/\/ /g; + $loc =~ s/[\<\>\/ ]//g; # Finished one row of results. Outputting newRow; - outputData($testName, "LEFT"); + #outputData($testName, "LEFT"); + print HTML "\n"; #outputData($iterCount); - outputData($noopers[0], "RIGHT"); + #outputData($noopers[0], "RIGHT"); + outputValue($noopers[0]); if(!$printEvents) { for $j ( 0 .. $#timedata ) { my $perOperation = $timedata[$j]->divideByScalar($iterPerPass[$j]*$noopers[$j]); # time per operation #debug("Time per operation: ".formatSeconds(4, $perOperation->getMean, $perOperation->getError)."\n"); - outputData(formatNumber(2, $mult, $perOperation->getMean), "RIGHT"); - outputData(formatNumber(2, $mult, $perOperation->getError), "RIGHT"); + outputDist($perOperation); } } my $baseLinePO = $timedata[0]->divideByScalar($iterPerPass[0]*$noopers[0]); @@ -302,26 +361,24 @@ sub outputRow { my $perOperation = $timedata[$j]->divideByScalar($iterPerPass[$j]*$noopers[$j]); # time per operation my $ratio = $baseLinePO->subtract($perOperation); $ratio = $ratio->divide($perOperation); - outputData(formatPercent(2, $ratio->getMean), "RIGHT"); - outputData(formatPercent(2, $ratio->getError), "RIGHT"); + outputDist($ratio, "%"); } if (@noevents) { for $j ( 0 .. $#timedata ) { - outputData($noevents[$j], "RIGHT"); + #outputData($noevents[$j], "RIGHT"); + outputValue($noevents[$j]); } for $j ( 0 .. $#timedata ) { my $perEvent = $timedata[$j]->divideByScalar($iterPerPass[$j]*$noevents[$j]); # time per event #debug("Time per operation: ".formatSeconds(4, $perEvent->getMean, $perEvent->getError)."\n"); - outputData(formatNumber(2, $mult, $perEvent->getMean), "RIGHT"); - outputData(formatNumber(2, $mult, $perEvent->getError), "RIGHT"); + outputDist($perEvent); } my $baseLinePO = $timedata[0]->divideByScalar($iterPerPass[0]*$noevents[0]); for $j ( 1 .. $#timedata ) { my $perOperation = $timedata[$j]->divideByScalar($iterPerPass[$j]*$noevents[$j]); # time per operation my $ratio = $baseLinePO->subtract($perOperation); $ratio = $ratio->divide($perOperation); - outputData(formatPercent(2, $ratio->getMean), "RIGHT"); - outputData(formatPercent(2, $ratio->getError), "RIGHT"); + outputDist($ratio, "%"); } } }
$printkey
test nameinteresting argumentsiterationsoperationsmean time (ns)error (ns)events
$printkey
test nameinteresting argumentsiterationsoperationsmean time (ns)error (ns)events
$printkey
test nameinteresting argumentsiterationsoperationsmean time (ns)error (ns)
$printkey
test nameinteresting argumentsiterationsoperationsmean time (ns)error (ns)
".$test."".$args.""; + if(!$done{$test}) { + print HTML "".$test.""; + $done{$test} = 1; + } else { + print HTML $test; + } + print HTML "".$args."".shift(@$j)."".shift(@$j)."".shift(@$j)."".shift(@$j)."".shift(@$j)."".formatNumber(4, $mult, $ds->getMean)."".formatNumber(4, $mult, $ds->getError)."".formatNumber(4, $mult, $ds->getMean)."".formatNumber(4, $mult, $ds->getError)."".shift(@$j)."".shift(@$j)."
$testName