1bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert#!/usr/local/bin/perl 2bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert 3bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert# ******************************************************************** 4bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert# * COPYRIGHT: 5bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert# * Copyright (c) 2006, International Business Machines Corporation and 6bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert# * others. All Rights Reserved. 7bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert# ******************************************************************** 8bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert 9bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert 10bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertuse strict; 11bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert 12bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertuse Dataset; 13bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert 14bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertmy $TABLEATTR = 'BORDER="1" CELLPADDING="4" CELLSPACING="0"'; 15bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertmy $outType = "HTML"; 16bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertmy $html = "noName"; 17bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertmy $inTable; 18bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertmy @headers; 19bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertmy @timetypes = ("mean per op", "error per op", "events", "per event"); 20bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertmy %raw; 21bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertmy $current = ""; 22bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertmy $exp = 0; 23bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertmy $mult = 1e9; #use nanoseconds 24bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertmy $perc = 100; #for percent 25bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertmy $printEvents = 0; 26bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertmy $legend = "<a name=\"Legend\">\n<h2>Table legend</h2></a><ul>"; 27bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertmy $legendDone = 0; 28bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertmy %options; 29bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertmy $operationIs = "operation"; 30bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertmy $eventIs = "event"; 31bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert 32bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertsub startTest { 33bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert $current = shift; 34bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert $exp = 0; 35bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert outputData($current); 36bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert} 37bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert 38bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertsub printLeg { 39bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert if(!$legendDone) { 40bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my $message; 41bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert foreach $message (@_) { 42bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert $legend .= "<li>".$message."</li>\n"; 43bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 44bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 45bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert} 46bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert 47bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertsub outputDist { 48bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my $value = shift; 49bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my $percent = shift; 50bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my $mean = $value->getMean; 51bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my $error = $value->getError; 52bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "<td class=\""; 53bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert if($mean > 0) { 54bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "value"; 55bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } else { 56bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "worse"; 57bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 58bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "\">"; 59bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert if($percent) { 60bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML formatPercent(2, $mean); 61bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } else { 62bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML formatNumber(2, $mult, $mean); 63bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 64bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "</td>\n"; 65bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "<td class=\""; 66bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert if((($error*$mult < 10)&&!$percent) || (($error<10)&&$percent)) { 67bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "error"; 68bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } else { 69bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "errorLarge"; 70bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 71bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "\">±"; 72bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert if($percent) { 73bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML formatPercent(2, $error); 74bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } else { 75bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML formatNumber(2, $mult, $error); 76bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 77bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "</td>\n"; 78bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert} 79bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert 80bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertsub outputValue { 81bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my $value = shift; 82bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "<td class=\"sepvalue\">"; 83bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML $value; 84bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert #print HTML formatNumber(2, 1, $value); 85bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "</td>\n"; 86bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert} 87bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert 88bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertsub startTable { 89bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert #my $printEvents = shift; 90bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert $inTable = 1; 91bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my $i; 92bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "<table $TABLEATTR>\n"; 93bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "<tbody>\n"; 94bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert if($#headers >= 0) { 95bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my ($header, $i); 96bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "<tr>\n"; 97bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "<th rowspan=\"2\" class=\"testNameHeader\"><a href=\"#TestName\">Test Name</a></th>\n"; 98bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "<th rowspan=\"2\" class=\"testNameHeader\"><a href=\"#Ops\">Ops</a></th>\n"; 99bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert printLeg("<a name=\"Test Name\">TestName</a> - name of the test as set by the test writer\n", "<a name=\"Ops\">Ops</a> - number of ".$operationIs."s per iteration\n"); 100bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert if(!$printEvents) { 101bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "<th colspan=".((4*($#headers+1))-2)." class=\"sourceType\">Per Operation</th>\n"; 102bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } else { 103bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "<th colspan=".((2*($#headers+1))-2)." class=\"sourceType\">Per Operation</th>\n"; 104bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "<th colspan=".((5*($#headers+1))-2)." class=\"sourceType\">Per Event</th>\n"; 105bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 106bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "</tr>\n<tr>\n"; 107bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert if(!$printEvents) { 108bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert foreach $header (@headers) { 109bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "<th class=\"source\" colspan=2><a href=\"#meanop_$header\">$header<br>/op</a></th>\n"; 110bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert printLeg("<a name=\"meanop_$header\">$header /op</a> - mean time and error for $header per $operationIs"); 111bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 112bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 113bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert for $i (1 .. $#headers) { 114bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "<th class=\"source\" colspan=2><a href=\"#mean_op_$i\">ratio $i<br>/op</a></th>\n"; 115bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert printLeg("<a name=\"mean_op_$i\">ratio $i /op</a> - ratio and error of per $operationIs time, calculated as: (($headers[0] - $headers[$i])/$headers[$i])*100%, mean value"); 116bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 117bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert if($printEvents) { 118bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert foreach $header (@headers) { 119bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "<th class=\"source\"><a href=\"#events_$header\">$header<br>events</a></th>\n"; 120bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert printLeg("<a name=\"events_$header\">$header events</a> - number of ".$eventIs."s for $header per iteration"); 121bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 122bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert foreach $header (@headers) { 123bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "<th class=\"source\" colspan=2><a href=\"#mean_ev_$header\">$header<br>/ev</a></th>\n"; 124bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert printLeg("<a name=\"mean_ev_$header\">$header /ev</a> - mean time and error for $header per $eventIs"); 125bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 126bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert for $i (1 .. $#headers) { 127bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "<th class=\"source\" colspan=2><a href=\"#mean_ev_$i\">ratio $i<br>/ev</a></th>\n"; 128bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert printLeg("<a name=\"mean_ev_$i\">ratio $i /ev</a> - ratio and error of per $eventIs time, calculated as: (($headers[0] - $headers[$i])/$headers[$i])*100%, mean value"); 129bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 130bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 131bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "</tr>\n"; 132bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 133bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert $legendDone = 1; 134bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert} 135bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert 136bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertsub closeTable { 137bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert if($inTable) { 138bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert undef $inTable; 139bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "</tr>\n"; 140bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "</tbody>"; 141bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "</table>\n"; 142bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 143bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert} 144bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert 145bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertsub newRow { 146bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert if(!$inTable) { 147bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert startTable; 148bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } else { 149bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "</tr>\n"; 150bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 151bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "<tr>"; 152bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert} 153bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert 154bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertsub outputData { 155bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert if($inTable) { 156bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my $msg = shift; 157bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my $align = shift; 158bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "<td"; 159bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert if($align) { 160bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML " align = $align>"; 161bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } else { 162bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML ">"; 163bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 164bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "$msg"; 165bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "</td>"; 166bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } else { 167bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my $message; 168bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert foreach $message (@_) { 169bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "$message"; 170bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 171bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 172bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert} 173bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert 174bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertsub setupOutput { 175bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my $date = localtime; 176bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my $options = shift; 177bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert %options = %{ $options }; 178bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my $title = $options{ "title" }; 179bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my $headers = $options{ "headers" }; 180bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert if($options{ "operationIs" }) { 181bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert $operationIs = $options{ "operationIs" }; 182bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 183bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert if($options{ "eventIs" }) { 184bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert $eventIs = $options{ "eventIs" }; 185bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 186bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert @headers = split(/ /, $headers); 187bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my ($t, $rest); 188bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert ($t, $rest) = split(/\.\w+/, $0); 189bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert $t =~ /^.*\W(\w+)$/; 190bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert $t = $1; 191bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert if($outType eq 'HTML') { 192bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert $html = $date; 193bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert $html =~ s/://g; # ':' illegal 194bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert $html =~ s/\s*\d+$//; # delete year 195bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert $html =~ s/^\w+\s*//; # delete dow 196bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert $html = "$t $html.html"; 197bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert if($options{ "outputDir" }) { 198bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert $html = $options{ "outputDir" }."/".$html; 199bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 200bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert $html =~ s/ /_/g; 201bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert 202bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert open(HTML,">$html") or die "Can't write to $html: $!"; 203bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert 204bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert#<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 205bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML <<EOF; 206bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert<HTML> 207bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert <HEAD> 208bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 209bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert <TITLE>$title</TITLE> 210bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert<style> 211bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert<!-- 212bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertbody { font-size: 10pt; font-family: sans-serif } 213bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertth { font-size: 10pt; border: 0 solid #000080; padding: 5 } 214bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertth.testNameHeader { border-width: 1 } 215bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertth.testName { text-align: left; border-left-width: 1; border-right-width: 1; 216bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert border-bottom-width: 1 } 217bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertth.source { border-right-width: 1; border-bottom-width: 1 } 218bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertth.sourceType { border-right-width: 1; border-top-width: 1; border-bottom-width: 1 } 219bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Rouberttd { font-size: 10pt; text-align: Right; border: 0 solid #000080; padding: 5 } 220bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Rouberttd.string { text-align: Left; border-bottom-width:1; border-right-width:1 } 221bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Rouberttd.sepvalue { border-bottom-width: 1; border-right-width: 1 } 222bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Rouberttd.value { border-bottom-width: 1 } 223bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Rouberttd.worse { color: #FF0000; font-weight: bold; border-bottom-width: 1 } 224bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Rouberttd.error { font-size: 75%; border-right-width: 1; border-bottom-width: 1 } 225bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Rouberttd.errorLarge { font-size: 75%; color: #FF0000; font-weight: bold; border-right-width: 1; 226bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert border-bottom-width: 1 } 227bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik RoubertA:link { color: black; font-weight: normal; text-decoration: none} /* unvisited links */ 228bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik RoubertA:visited { color: blue; font-weight: normal; text-decoration: none } /* visited links */ 229bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik RoubertA:hover { color: red; font-weight: normal; text-decoration: none } /* user hovers */ 230bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik RoubertA:active { color: lime; font-weight: normal; text-decoration: none } /* active links */ 231bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert--> 232bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert</style> 233bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert </HEAD> 234bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert <BODY bgcolor="#FFFFFF" LINK="#006666" VLINK="#000000"> 235bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik RoubertEOF 236bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "<H1>$title</H1>\n"; 237bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert 238bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert #print HTML "<H2>$TESTCLASS</H2>\n"; 239bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 240bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert} 241bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert 242bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertsub closeOutput { 243bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert if($outType eq 'HTML') { 244bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert if($inTable) { 245bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert closeTable; 246bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 247bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert $legend .= "</ul>\n"; 248bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML $legend; 249bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert outputRaw(); 250bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML <<EOF; 251bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert </BODY> 252bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert</HTML> 253bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik RoubertEOF 254bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert close(HTML) or die "Can't close $html: $!"; 255bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 256bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert} 257bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert 258bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert 259bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertsub outputRaw { 260bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "<h2>Raw data</h2>"; 261bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my $key; 262bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my $i; 263bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my $j; 264bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my $k; 265bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "<table $TABLEATTR>\n"; 266bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert for $key (sort keys %raw) { 267bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my $printkey = $key; 268bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert $printkey =~ s/\<br\>/ /g; 269bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert if($printEvents) { 270bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert if($key ne "") { 271bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "<tr><th class=\"testNameHeader\" colspan = 7>$printkey</td></tr>\n"; # locale and data file 272bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 273bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "<tr><th class=\"testName\">test name</th><th class=\"testName\">interesting arguments</th><th class=\"testName\">iterations</th><th class=\"testName\">operations</th><th class=\"testName\">mean time (ns)</th><th class=\"testName\">error (ns)</th><th class=\"testName\">events</th></tr>\n"; 274bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } else { 275bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert if($key ne "") { 276bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "<tr><th class=\"testName\" colspan = 6>$printkey</td></tr>\n"; # locale and data file 277bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 278bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "<tr><th class=\"testName\">test name</th><th class=\"testName\">interesting arguments</th><th class=\"testName\">iterations</th><th class=\"testName\">operations</th><th class=\"testName\">mean time (ns)</th><th class=\"testName\">error (ns)</th></tr>\n"; 279bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 280bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert $printkey =~ s/[\<\>\/ ]//g; 281bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert 282bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my %done; 283bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert for $i ( $raw{$key} ) { 284bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "<tr>"; 285bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert for $j ( @$i ) { 286bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my ($test, $args); 287bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert ($test, $args) = split(/,/, shift(@$j)); 288bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert 289bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "<th class=\"testName\">"; 290bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert if(!$done{$test}) { 291bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "<a name=\"".$printkey."_".$test."\">".$test."</a>"; 292bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert $done{$test} = 1; 293bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } else { 294bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML $test; 295bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 296bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "</th>"; 297bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert 298bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "<td class=\"string\">".$args."</td>"; 299bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert 300bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "<td class=\"sepvalue\">".shift(@$j)."</td>"; 301bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "<td class=\"sepvalue\">".shift(@$j)."</td>"; 302bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert 303bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my @data = @{ shift(@$j) }; 304bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my $ds = Dataset->new(@data); 305bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "<td class=\"sepvalue\">".formatNumber(4, $mult, $ds->getMean)."</td><td class=\"sepvalue\">".formatNumber(4, $mult, $ds->getError)."</td>"; 306bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert if($#{ $j } >= 0) { 307bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "<td class=\"sepvalue\">".shift(@$j)."</td>"; 308bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 309bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "</tr>\n"; 310bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 311bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 312bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 313bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert} 314bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert 315bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertsub store { 316bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert $raw{$current}[$exp++] = [@_]; 317bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert} 318bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert 319bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubertsub outputRow { 320bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert #$raw{$current}[$exp++] = [@_]; 321bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my $testName = shift; 322bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my @iterPerPass = @{shift(@_)}; 323bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my @noopers = @{shift(@_)}; 324bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my @timedata = @{shift(@_)}; 325bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my @noevents; 326bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert if($#_ >= 0) { 327bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert @noevents = @{shift(@_)}; 328bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 329bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert if(!$inTable) { 330bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert if(@noevents) { 331bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert $printEvents = 1; 332bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert startTable; 333bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } else { 334bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert startTable; 335bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 336bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 337bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert debug("No events: @noevents, $#noevents\n"); 338bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert 339bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my $j; 340bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my $loc = $current; 341bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert $loc =~ s/\<br\>/ /g; 342bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert $loc =~ s/[\<\>\/ ]//g; 343bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert 344bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert # Finished one row of results. Outputting 345bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert newRow; 346bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert #outputData($testName, "LEFT"); 347bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert print HTML "<th class=\"testName\"><a href=\"#".$loc."_".$testName."\">$testName</a></th>\n"; 348bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert #outputData($iterCount); 349bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert #outputData($noopers[0], "RIGHT"); 350bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert outputValue($noopers[0]); 351bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert 352bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert if(!$printEvents) { 353bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert for $j ( 0 .. $#timedata ) { 354bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my $perOperation = $timedata[$j]->divideByScalar($iterPerPass[$j]*$noopers[$j]); # time per operation 355bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert #debug("Time per operation: ".formatSeconds(4, $perOperation->getMean, $perOperation->getError)."\n"); 356bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert outputDist($perOperation); 357bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 358bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 359bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my $baseLinePO = $timedata[0]->divideByScalar($iterPerPass[0]*$noopers[0]); 360bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert for $j ( 1 .. $#timedata ) { 361bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my $perOperation = $timedata[$j]->divideByScalar($iterPerPass[$j]*$noopers[$j]); # time per operation 362bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my $ratio = $baseLinePO->subtract($perOperation); 363bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert $ratio = $ratio->divide($perOperation); 364bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert outputDist($ratio, "%"); 365bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 366bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert if (@noevents) { 367bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert for $j ( 0 .. $#timedata ) { 368bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert #outputData($noevents[$j], "RIGHT"); 369bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert outputValue($noevents[$j]); 370bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 371bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert for $j ( 0 .. $#timedata ) { 372bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my $perEvent = $timedata[$j]->divideByScalar($iterPerPass[$j]*$noevents[$j]); # time per event 373bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert #debug("Time per operation: ".formatSeconds(4, $perEvent->getMean, $perEvent->getError)."\n"); 374bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert outputDist($perEvent); 375bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 376bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my $baseLinePO = $timedata[0]->divideByScalar($iterPerPass[0]*$noevents[0]); 377bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert for $j ( 1 .. $#timedata ) { 378bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my $perOperation = $timedata[$j]->divideByScalar($iterPerPass[$j]*$noevents[$j]); # time per operation 379bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert my $ratio = $baseLinePO->subtract($perOperation); 380bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert $ratio = $ratio->divide($perOperation); 381bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert outputDist($ratio, "%"); 382bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 383bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert } 384bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert} 385bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert 386bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert 387bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert1; 388bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert 389bd1cbb618dcaa1ac6ba7c77dece35cb79593a5d7Fredrik Roubert#eof 390