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