12e5b6d6dSopenharmony_ci#!/usr/local/bin/perl 22e5b6d6dSopenharmony_ci 32e5b6d6dSopenharmony_ci# ******************************************************************** 42e5b6d6dSopenharmony_ci# * COPYRIGHT: 52e5b6d6dSopenharmony_ci# * © 2016 and later: Unicode, Inc. and others. 62e5b6d6dSopenharmony_ci# * License & terms of use: http://www.unicode.org/copyright.html 72e5b6d6dSopenharmony_ci# * Copyright (c) 2006, International Business Machines Corporation and 82e5b6d6dSopenharmony_ci# * others. All Rights Reserved. 92e5b6d6dSopenharmony_ci# ******************************************************************** 102e5b6d6dSopenharmony_ci 112e5b6d6dSopenharmony_ci 122e5b6d6dSopenharmony_ciuse strict; 132e5b6d6dSopenharmony_ci 142e5b6d6dSopenharmony_ciuse Dataset; 152e5b6d6dSopenharmony_ci 162e5b6d6dSopenharmony_cimy $TABLEATTR = 'BORDER="1" CELLPADDING="4" CELLSPACING="0"'; 172e5b6d6dSopenharmony_cimy $outType = "HTML"; 182e5b6d6dSopenharmony_cimy $html = "noName"; 192e5b6d6dSopenharmony_cimy $inTable; 202e5b6d6dSopenharmony_cimy @headers; 212e5b6d6dSopenharmony_cimy @timetypes = ("mean per op", "error per op", "events", "per event"); 222e5b6d6dSopenharmony_cimy %raw; 232e5b6d6dSopenharmony_cimy $current = ""; 242e5b6d6dSopenharmony_cimy $exp = 0; 252e5b6d6dSopenharmony_cimy $mult = 1e9; #use nanoseconds 262e5b6d6dSopenharmony_cimy $perc = 100; #for percent 272e5b6d6dSopenharmony_cimy $printEvents = 0; 282e5b6d6dSopenharmony_cimy $legend = "<a name=\"Legend\">\n<h2>Table legend</h2></a><ul>"; 292e5b6d6dSopenharmony_cimy $legendDone = 0; 302e5b6d6dSopenharmony_cimy %options; 312e5b6d6dSopenharmony_cimy $operationIs = "operation"; 322e5b6d6dSopenharmony_cimy $eventIs = "event"; 332e5b6d6dSopenharmony_ci 342e5b6d6dSopenharmony_cisub startTest { 352e5b6d6dSopenharmony_ci $current = shift; 362e5b6d6dSopenharmony_ci $exp = 0; 372e5b6d6dSopenharmony_ci outputData($current); 382e5b6d6dSopenharmony_ci} 392e5b6d6dSopenharmony_ci 402e5b6d6dSopenharmony_cisub printLeg { 412e5b6d6dSopenharmony_ci if(!$legendDone) { 422e5b6d6dSopenharmony_ci my $message; 432e5b6d6dSopenharmony_ci foreach $message (@_) { 442e5b6d6dSopenharmony_ci $legend .= "<li>".$message."</li>\n"; 452e5b6d6dSopenharmony_ci } 462e5b6d6dSopenharmony_ci } 472e5b6d6dSopenharmony_ci} 482e5b6d6dSopenharmony_ci 492e5b6d6dSopenharmony_cisub outputDist { 502e5b6d6dSopenharmony_ci my $value = shift; 512e5b6d6dSopenharmony_ci my $percent = shift; 522e5b6d6dSopenharmony_ci my $mean = $value->getMean; 532e5b6d6dSopenharmony_ci my $error = $value->getError; 542e5b6d6dSopenharmony_ci print HTML "<td class=\""; 552e5b6d6dSopenharmony_ci if($mean > 0) { 562e5b6d6dSopenharmony_ci print HTML "value"; 572e5b6d6dSopenharmony_ci } else { 582e5b6d6dSopenharmony_ci print HTML "worse"; 592e5b6d6dSopenharmony_ci } 602e5b6d6dSopenharmony_ci print HTML "\">"; 612e5b6d6dSopenharmony_ci if($percent) { 622e5b6d6dSopenharmony_ci print HTML formatPercent(2, $mean); 632e5b6d6dSopenharmony_ci } else { 642e5b6d6dSopenharmony_ci print HTML formatNumber(2, $mult, $mean); 652e5b6d6dSopenharmony_ci } 662e5b6d6dSopenharmony_ci print HTML "</td>\n"; 672e5b6d6dSopenharmony_ci print HTML "<td class=\""; 682e5b6d6dSopenharmony_ci if((($error*$mult < 10)&&!$percent) || (($error<10)&&$percent)) { 692e5b6d6dSopenharmony_ci print HTML "error"; 702e5b6d6dSopenharmony_ci } else { 712e5b6d6dSopenharmony_ci print HTML "errorLarge"; 722e5b6d6dSopenharmony_ci } 732e5b6d6dSopenharmony_ci print HTML "\">±"; 742e5b6d6dSopenharmony_ci if($percent) { 752e5b6d6dSopenharmony_ci print HTML formatPercent(2, $error); 762e5b6d6dSopenharmony_ci } else { 772e5b6d6dSopenharmony_ci print HTML formatNumber(2, $mult, $error); 782e5b6d6dSopenharmony_ci } 792e5b6d6dSopenharmony_ci print HTML "</td>\n"; 802e5b6d6dSopenharmony_ci} 812e5b6d6dSopenharmony_ci 822e5b6d6dSopenharmony_cisub outputValue { 832e5b6d6dSopenharmony_ci my $value = shift; 842e5b6d6dSopenharmony_ci print HTML "<td class=\"sepvalue\">"; 852e5b6d6dSopenharmony_ci print HTML $value; 862e5b6d6dSopenharmony_ci #print HTML formatNumber(2, 1, $value); 872e5b6d6dSopenharmony_ci print HTML "</td>\n"; 882e5b6d6dSopenharmony_ci} 892e5b6d6dSopenharmony_ci 902e5b6d6dSopenharmony_cisub startTable { 912e5b6d6dSopenharmony_ci #my $printEvents = shift; 922e5b6d6dSopenharmony_ci $inTable = 1; 932e5b6d6dSopenharmony_ci my $i; 942e5b6d6dSopenharmony_ci print HTML "<table $TABLEATTR>\n"; 952e5b6d6dSopenharmony_ci print HTML "<tbody>\n"; 962e5b6d6dSopenharmony_ci if($#headers >= 0) { 972e5b6d6dSopenharmony_ci my ($header, $i); 982e5b6d6dSopenharmony_ci print HTML "<tr>\n"; 992e5b6d6dSopenharmony_ci print HTML "<th rowspan=\"2\" class=\"testNameHeader\"><a href=\"#TestName\">Test Name</a></th>\n"; 1002e5b6d6dSopenharmony_ci print HTML "<th rowspan=\"2\" class=\"testNameHeader\"><a href=\"#Ops\">Ops</a></th>\n"; 1012e5b6d6dSopenharmony_ci 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"); 1022e5b6d6dSopenharmony_ci if(!$printEvents) { 1032e5b6d6dSopenharmony_ci print HTML "<th colspan=".((4*($#headers+1))-2)." class=\"sourceType\">Per Operation</th>\n"; 1042e5b6d6dSopenharmony_ci } else { 1052e5b6d6dSopenharmony_ci print HTML "<th colspan=".((2*($#headers+1))-2)." class=\"sourceType\">Per Operation</th>\n"; 1062e5b6d6dSopenharmony_ci print HTML "<th colspan=".((5*($#headers+1))-2)." class=\"sourceType\">Per Event</th>\n"; 1072e5b6d6dSopenharmony_ci } 1082e5b6d6dSopenharmony_ci print HTML "</tr>\n<tr>\n"; 1092e5b6d6dSopenharmony_ci if(!$printEvents) { 1102e5b6d6dSopenharmony_ci foreach $header (@headers) { 1112e5b6d6dSopenharmony_ci print HTML "<th class=\"source\" colspan=2><a href=\"#meanop_$header\">$header<br>/op</a></th>\n"; 1122e5b6d6dSopenharmony_ci printLeg("<a name=\"meanop_$header\">$header /op</a> - mean time and error for $header per $operationIs"); 1132e5b6d6dSopenharmony_ci } 1142e5b6d6dSopenharmony_ci } 1152e5b6d6dSopenharmony_ci for $i (1 .. $#headers) { 1162e5b6d6dSopenharmony_ci print HTML "<th class=\"source\" colspan=2><a href=\"#mean_op_$i\">ratio $i<br>/op</a></th>\n"; 1172e5b6d6dSopenharmony_ci 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"); 1182e5b6d6dSopenharmony_ci } 1192e5b6d6dSopenharmony_ci if($printEvents) { 1202e5b6d6dSopenharmony_ci foreach $header (@headers) { 1212e5b6d6dSopenharmony_ci print HTML "<th class=\"source\"><a href=\"#events_$header\">$header<br>events</a></th>\n"; 1222e5b6d6dSopenharmony_ci printLeg("<a name=\"events_$header\">$header events</a> - number of ".$eventIs."s for $header per iteration"); 1232e5b6d6dSopenharmony_ci } 1242e5b6d6dSopenharmony_ci foreach $header (@headers) { 1252e5b6d6dSopenharmony_ci print HTML "<th class=\"source\" colspan=2><a href=\"#mean_ev_$header\">$header<br>/ev</a></th>\n"; 1262e5b6d6dSopenharmony_ci printLeg("<a name=\"mean_ev_$header\">$header /ev</a> - mean time and error for $header per $eventIs"); 1272e5b6d6dSopenharmony_ci } 1282e5b6d6dSopenharmony_ci for $i (1 .. $#headers) { 1292e5b6d6dSopenharmony_ci print HTML "<th class=\"source\" colspan=2><a href=\"#mean_ev_$i\">ratio $i<br>/ev</a></th>\n"; 1302e5b6d6dSopenharmony_ci 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"); 1312e5b6d6dSopenharmony_ci } 1322e5b6d6dSopenharmony_ci } 1332e5b6d6dSopenharmony_ci print HTML "</tr>\n"; 1342e5b6d6dSopenharmony_ci } 1352e5b6d6dSopenharmony_ci $legendDone = 1; 1362e5b6d6dSopenharmony_ci} 1372e5b6d6dSopenharmony_ci 1382e5b6d6dSopenharmony_cisub closeTable { 1392e5b6d6dSopenharmony_ci if($inTable) { 1402e5b6d6dSopenharmony_ci undef $inTable; 1412e5b6d6dSopenharmony_ci print HTML "</tr>\n"; 1422e5b6d6dSopenharmony_ci print HTML "</tbody>"; 1432e5b6d6dSopenharmony_ci print HTML "</table>\n"; 1442e5b6d6dSopenharmony_ci } 1452e5b6d6dSopenharmony_ci} 1462e5b6d6dSopenharmony_ci 1472e5b6d6dSopenharmony_cisub newRow { 1482e5b6d6dSopenharmony_ci if(!$inTable) { 1492e5b6d6dSopenharmony_ci startTable; 1502e5b6d6dSopenharmony_ci } else { 1512e5b6d6dSopenharmony_ci print HTML "</tr>\n"; 1522e5b6d6dSopenharmony_ci } 1532e5b6d6dSopenharmony_ci print HTML "<tr>"; 1542e5b6d6dSopenharmony_ci} 1552e5b6d6dSopenharmony_ci 1562e5b6d6dSopenharmony_cisub outputData { 1572e5b6d6dSopenharmony_ci if($inTable) { 1582e5b6d6dSopenharmony_ci my $msg = shift; 1592e5b6d6dSopenharmony_ci my $align = shift; 1602e5b6d6dSopenharmony_ci print HTML "<td"; 1612e5b6d6dSopenharmony_ci if($align) { 1622e5b6d6dSopenharmony_ci print HTML " align = $align>"; 1632e5b6d6dSopenharmony_ci } else { 1642e5b6d6dSopenharmony_ci print HTML ">"; 1652e5b6d6dSopenharmony_ci } 1662e5b6d6dSopenharmony_ci print HTML "$msg"; 1672e5b6d6dSopenharmony_ci print HTML "</td>"; 1682e5b6d6dSopenharmony_ci } else { 1692e5b6d6dSopenharmony_ci my $message; 1702e5b6d6dSopenharmony_ci foreach $message (@_) { 1712e5b6d6dSopenharmony_ci print HTML "$message"; 1722e5b6d6dSopenharmony_ci } 1732e5b6d6dSopenharmony_ci } 1742e5b6d6dSopenharmony_ci} 1752e5b6d6dSopenharmony_ci 1762e5b6d6dSopenharmony_cisub setupOutput { 1772e5b6d6dSopenharmony_ci my $date = localtime; 1782e5b6d6dSopenharmony_ci my $options = shift; 1792e5b6d6dSopenharmony_ci %options = %{ $options }; 1802e5b6d6dSopenharmony_ci my $title = $options{ "title" }; 1812e5b6d6dSopenharmony_ci my $headers = $options{ "headers" }; 1822e5b6d6dSopenharmony_ci if($options{ "operationIs" }) { 1832e5b6d6dSopenharmony_ci $operationIs = $options{ "operationIs" }; 1842e5b6d6dSopenharmony_ci } 1852e5b6d6dSopenharmony_ci if($options{ "eventIs" }) { 1862e5b6d6dSopenharmony_ci $eventIs = $options{ "eventIs" }; 1872e5b6d6dSopenharmony_ci } 1882e5b6d6dSopenharmony_ci @headers = split(/ /, $headers); 1892e5b6d6dSopenharmony_ci my ($t, $rest); 1902e5b6d6dSopenharmony_ci ($t, $rest) = split(/\.\w+/, $0); 1912e5b6d6dSopenharmony_ci $t =~ /^.*\W(\w+)$/; 1922e5b6d6dSopenharmony_ci $t = $1; 1932e5b6d6dSopenharmony_ci if($outType eq 'HTML') { 1942e5b6d6dSopenharmony_ci $html = $date; 1952e5b6d6dSopenharmony_ci $html =~ s/://g; # ':' illegal 1962e5b6d6dSopenharmony_ci $html =~ s/\s*\d+$//; # delete year 1972e5b6d6dSopenharmony_ci $html =~ s/^\w+\s*//; # delete dow 1982e5b6d6dSopenharmony_ci $html = "$t $html.html"; 1992e5b6d6dSopenharmony_ci if($options{ "outputDir" }) { 2002e5b6d6dSopenharmony_ci $html = $options{ "outputDir" }."/".$html; 2012e5b6d6dSopenharmony_ci } 2022e5b6d6dSopenharmony_ci $html =~ s/ /_/g; 2032e5b6d6dSopenharmony_ci 2042e5b6d6dSopenharmony_ci open(HTML,">$html") or die "Can't write to $html: $!"; 2052e5b6d6dSopenharmony_ci 2062e5b6d6dSopenharmony_ci#<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 2072e5b6d6dSopenharmony_ci print HTML <<EOF; 2082e5b6d6dSopenharmony_ci<HTML> 2092e5b6d6dSopenharmony_ci <HEAD> 2102e5b6d6dSopenharmony_ci <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 2112e5b6d6dSopenharmony_ci <TITLE>$title</TITLE> 2122e5b6d6dSopenharmony_ci<style> 2132e5b6d6dSopenharmony_ci<!-- 2142e5b6d6dSopenharmony_cibody { font-size: 10pt; font-family: sans-serif } 2152e5b6d6dSopenharmony_cith { font-size: 10pt; border: 0 solid #000080; padding: 5 } 2162e5b6d6dSopenharmony_cith.testNameHeader { border-width: 1 } 2172e5b6d6dSopenharmony_cith.testName { text-align: left; border-left-width: 1; border-right-width: 1; 2182e5b6d6dSopenharmony_ci border-bottom-width: 1 } 2192e5b6d6dSopenharmony_cith.source { border-right-width: 1; border-bottom-width: 1 } 2202e5b6d6dSopenharmony_cith.sourceType { border-right-width: 1; border-top-width: 1; border-bottom-width: 1 } 2212e5b6d6dSopenharmony_citd { font-size: 10pt; text-align: Right; border: 0 solid #000080; padding: 5 } 2222e5b6d6dSopenharmony_citd.string { text-align: Left; border-bottom-width:1; border-right-width:1 } 2232e5b6d6dSopenharmony_citd.sepvalue { border-bottom-width: 1; border-right-width: 1 } 2242e5b6d6dSopenharmony_citd.value { border-bottom-width: 1 } 2252e5b6d6dSopenharmony_citd.worse { color: #FF0000; font-weight: bold; border-bottom-width: 1 } 2262e5b6d6dSopenharmony_citd.error { font-size: 75%; border-right-width: 1; border-bottom-width: 1 } 2272e5b6d6dSopenharmony_citd.errorLarge { font-size: 75%; color: #FF0000; font-weight: bold; border-right-width: 1; 2282e5b6d6dSopenharmony_ci border-bottom-width: 1 } 2292e5b6d6dSopenharmony_ciA:link { color: black; font-weight: normal; text-decoration: none} /* unvisited links */ 2302e5b6d6dSopenharmony_ciA:visited { color: blue; font-weight: normal; text-decoration: none } /* visited links */ 2312e5b6d6dSopenharmony_ciA:hover { color: red; font-weight: normal; text-decoration: none } /* user hovers */ 2322e5b6d6dSopenharmony_ciA:active { color: lime; font-weight: normal; text-decoration: none } /* active links */ 2332e5b6d6dSopenharmony_ci--> 2342e5b6d6dSopenharmony_ci</style> 2352e5b6d6dSopenharmony_ci </HEAD> 2362e5b6d6dSopenharmony_ci <BODY bgcolor="#FFFFFF" LINK="#006666" VLINK="#000000"> 2372e5b6d6dSopenharmony_ciEOF 2382e5b6d6dSopenharmony_ci print HTML "<H1>$title</H1>\n"; 2392e5b6d6dSopenharmony_ci 2402e5b6d6dSopenharmony_ci #print HTML "<H2>$TESTCLASS</H2>\n"; 2412e5b6d6dSopenharmony_ci } 2422e5b6d6dSopenharmony_ci} 2432e5b6d6dSopenharmony_ci 2442e5b6d6dSopenharmony_cisub closeOutput { 2452e5b6d6dSopenharmony_ci if($outType eq 'HTML') { 2462e5b6d6dSopenharmony_ci if($inTable) { 2472e5b6d6dSopenharmony_ci closeTable; 2482e5b6d6dSopenharmony_ci } 2492e5b6d6dSopenharmony_ci $legend .= "</ul>\n"; 2502e5b6d6dSopenharmony_ci print HTML $legend; 2512e5b6d6dSopenharmony_ci outputRaw(); 2522e5b6d6dSopenharmony_ci print HTML <<EOF; 2532e5b6d6dSopenharmony_ci </BODY> 2542e5b6d6dSopenharmony_ci</HTML> 2552e5b6d6dSopenharmony_ciEOF 2562e5b6d6dSopenharmony_ci close(HTML) or die "Can't close $html: $!"; 2572e5b6d6dSopenharmony_ci } 2582e5b6d6dSopenharmony_ci} 2592e5b6d6dSopenharmony_ci 2602e5b6d6dSopenharmony_ci 2612e5b6d6dSopenharmony_cisub outputRaw { 2622e5b6d6dSopenharmony_ci print HTML "<h2>Raw data</h2>"; 2632e5b6d6dSopenharmony_ci my $key; 2642e5b6d6dSopenharmony_ci my $i; 2652e5b6d6dSopenharmony_ci my $j; 2662e5b6d6dSopenharmony_ci my $k; 2672e5b6d6dSopenharmony_ci print HTML "<table $TABLEATTR>\n"; 2682e5b6d6dSopenharmony_ci for $key (sort keys %raw) { 2692e5b6d6dSopenharmony_ci my $printkey = $key; 2702e5b6d6dSopenharmony_ci $printkey =~ s/\<br\>/ /g; 2712e5b6d6dSopenharmony_ci if($printEvents) { 2722e5b6d6dSopenharmony_ci if($key ne "") { 2732e5b6d6dSopenharmony_ci print HTML "<tr><th class=\"testNameHeader\" colspan = 7>$printkey</td></tr>\n"; # locale and data file 2742e5b6d6dSopenharmony_ci } 2752e5b6d6dSopenharmony_ci 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"; 2762e5b6d6dSopenharmony_ci } else { 2772e5b6d6dSopenharmony_ci if($key ne "") { 2782e5b6d6dSopenharmony_ci print HTML "<tr><th class=\"testName\" colspan = 6>$printkey</td></tr>\n"; # locale and data file 2792e5b6d6dSopenharmony_ci } 2802e5b6d6dSopenharmony_ci 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"; 2812e5b6d6dSopenharmony_ci } 2822e5b6d6dSopenharmony_ci $printkey =~ s/[\<\>\/ ]//g; 2832e5b6d6dSopenharmony_ci 2842e5b6d6dSopenharmony_ci my %done; 2852e5b6d6dSopenharmony_ci for $i ( $raw{$key} ) { 2862e5b6d6dSopenharmony_ci print HTML "<tr>"; 2872e5b6d6dSopenharmony_ci for $j ( @$i ) { 2882e5b6d6dSopenharmony_ci my ($test, $args); 2892e5b6d6dSopenharmony_ci ($test, $args) = split(/,/, shift(@$j)); 2902e5b6d6dSopenharmony_ci 2912e5b6d6dSopenharmony_ci print HTML "<th class=\"testName\">"; 2922e5b6d6dSopenharmony_ci if(!$done{$test}) { 2932e5b6d6dSopenharmony_ci print HTML "<a name=\"".$printkey."_".$test."\">".$test."</a>"; 2942e5b6d6dSopenharmony_ci $done{$test} = 1; 2952e5b6d6dSopenharmony_ci } else { 2962e5b6d6dSopenharmony_ci print HTML $test; 2972e5b6d6dSopenharmony_ci } 2982e5b6d6dSopenharmony_ci print HTML "</th>"; 2992e5b6d6dSopenharmony_ci 3002e5b6d6dSopenharmony_ci print HTML "<td class=\"string\">".$args."</td>"; 3012e5b6d6dSopenharmony_ci 3022e5b6d6dSopenharmony_ci print HTML "<td class=\"sepvalue\">".shift(@$j)."</td>"; 3032e5b6d6dSopenharmony_ci print HTML "<td class=\"sepvalue\">".shift(@$j)."</td>"; 3042e5b6d6dSopenharmony_ci 3052e5b6d6dSopenharmony_ci my @data = @{ shift(@$j) }; 3062e5b6d6dSopenharmony_ci my $ds = Dataset->new(@data); 3072e5b6d6dSopenharmony_ci print HTML "<td class=\"sepvalue\">".formatNumber(4, $mult, $ds->getMean)."</td><td class=\"sepvalue\">".formatNumber(4, $mult, $ds->getError)."</td>"; 3082e5b6d6dSopenharmony_ci if($#{ $j } >= 0) { 3092e5b6d6dSopenharmony_ci print HTML "<td class=\"sepvalue\">".shift(@$j)."</td>"; 3102e5b6d6dSopenharmony_ci } 3112e5b6d6dSopenharmony_ci print HTML "</tr>\n"; 3122e5b6d6dSopenharmony_ci } 3132e5b6d6dSopenharmony_ci } 3142e5b6d6dSopenharmony_ci } 3152e5b6d6dSopenharmony_ci} 3162e5b6d6dSopenharmony_ci 3172e5b6d6dSopenharmony_cisub store { 3182e5b6d6dSopenharmony_ci $raw{$current}[$exp++] = [@_]; 3192e5b6d6dSopenharmony_ci} 3202e5b6d6dSopenharmony_ci 3212e5b6d6dSopenharmony_cisub outputRow { 3222e5b6d6dSopenharmony_ci #$raw{$current}[$exp++] = [@_]; 3232e5b6d6dSopenharmony_ci my $testName = shift; 3242e5b6d6dSopenharmony_ci my @iterPerPass = @{shift(@_)}; 3252e5b6d6dSopenharmony_ci my @noopers = @{shift(@_)}; 3262e5b6d6dSopenharmony_ci my @timedata = @{shift(@_)}; 3272e5b6d6dSopenharmony_ci my @noevents; 3282e5b6d6dSopenharmony_ci if($#_ >= 0) { 3292e5b6d6dSopenharmony_ci @noevents = @{shift(@_)}; 3302e5b6d6dSopenharmony_ci } 3312e5b6d6dSopenharmony_ci if(!$inTable) { 3322e5b6d6dSopenharmony_ci if(@noevents) { 3332e5b6d6dSopenharmony_ci $printEvents = 1; 3342e5b6d6dSopenharmony_ci startTable; 3352e5b6d6dSopenharmony_ci } else { 3362e5b6d6dSopenharmony_ci startTable; 3372e5b6d6dSopenharmony_ci } 3382e5b6d6dSopenharmony_ci } 3392e5b6d6dSopenharmony_ci debug("No events: @noevents, $#noevents\n"); 3402e5b6d6dSopenharmony_ci 3412e5b6d6dSopenharmony_ci my $j; 3422e5b6d6dSopenharmony_ci my $loc = $current; 3432e5b6d6dSopenharmony_ci $loc =~ s/\<br\>/ /g; 3442e5b6d6dSopenharmony_ci $loc =~ s/[\<\>\/ ]//g; 3452e5b6d6dSopenharmony_ci 3462e5b6d6dSopenharmony_ci # Finished one row of results. Outputting 3472e5b6d6dSopenharmony_ci newRow; 3482e5b6d6dSopenharmony_ci #outputData($testName, "LEFT"); 3492e5b6d6dSopenharmony_ci print HTML "<th class=\"testName\"><a href=\"#".$loc."_".$testName."\">$testName</a></th>\n"; 3502e5b6d6dSopenharmony_ci #outputData($iterCount); 3512e5b6d6dSopenharmony_ci #outputData($noopers[0], "RIGHT"); 3522e5b6d6dSopenharmony_ci outputValue($noopers[0]); 3532e5b6d6dSopenharmony_ci 3542e5b6d6dSopenharmony_ci if(!$printEvents) { 3552e5b6d6dSopenharmony_ci for $j ( 0 .. $#timedata ) { 3562e5b6d6dSopenharmony_ci my $perOperation = $timedata[$j]->divideByScalar($iterPerPass[$j]*$noopers[$j]); # time per operation 3572e5b6d6dSopenharmony_ci #debug("Time per operation: ".formatSeconds(4, $perOperation->getMean, $perOperation->getError)."\n"); 3582e5b6d6dSopenharmony_ci outputDist($perOperation); 3592e5b6d6dSopenharmony_ci } 3602e5b6d6dSopenharmony_ci } 3612e5b6d6dSopenharmony_ci my $baseLinePO = $timedata[0]->divideByScalar($iterPerPass[0]*$noopers[0]); 3622e5b6d6dSopenharmony_ci for $j ( 1 .. $#timedata ) { 3632e5b6d6dSopenharmony_ci my $perOperation = $timedata[$j]->divideByScalar($iterPerPass[$j]*$noopers[$j]); # time per operation 3642e5b6d6dSopenharmony_ci my $ratio = $baseLinePO->subtract($perOperation); 3652e5b6d6dSopenharmony_ci $ratio = $ratio->divide($perOperation); 3662e5b6d6dSopenharmony_ci outputDist($ratio, "%"); 3672e5b6d6dSopenharmony_ci } 3682e5b6d6dSopenharmony_ci if (@noevents) { 3692e5b6d6dSopenharmony_ci for $j ( 0 .. $#timedata ) { 3702e5b6d6dSopenharmony_ci #outputData($noevents[$j], "RIGHT"); 3712e5b6d6dSopenharmony_ci outputValue($noevents[$j]); 3722e5b6d6dSopenharmony_ci } 3732e5b6d6dSopenharmony_ci for $j ( 0 .. $#timedata ) { 3742e5b6d6dSopenharmony_ci my $perEvent = $timedata[$j]->divideByScalar($iterPerPass[$j]*$noevents[$j]); # time per event 3752e5b6d6dSopenharmony_ci #debug("Time per operation: ".formatSeconds(4, $perEvent->getMean, $perEvent->getError)."\n"); 3762e5b6d6dSopenharmony_ci outputDist($perEvent); 3772e5b6d6dSopenharmony_ci } 3782e5b6d6dSopenharmony_ci my $baseLinePO = $timedata[0]->divideByScalar($iterPerPass[0]*$noevents[0]); 3792e5b6d6dSopenharmony_ci for $j ( 1 .. $#timedata ) { 3802e5b6d6dSopenharmony_ci my $perOperation = $timedata[$j]->divideByScalar($iterPerPass[$j]*$noevents[$j]); # time per operation 3812e5b6d6dSopenharmony_ci my $ratio = $baseLinePO->subtract($perOperation); 3822e5b6d6dSopenharmony_ci $ratio = $ratio->divide($perOperation); 3832e5b6d6dSopenharmony_ci outputDist($ratio, "%"); 3842e5b6d6dSopenharmony_ci } 3852e5b6d6dSopenharmony_ci } 3862e5b6d6dSopenharmony_ci} 3872e5b6d6dSopenharmony_ci 3882e5b6d6dSopenharmony_ci 3892e5b6d6dSopenharmony_ci1; 3902e5b6d6dSopenharmony_ci 3912e5b6d6dSopenharmony_ci#eof 392