| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <style> | |
| 4 body { | |
| 5 font-family: monospace; | |
| 6 } | |
| 7 table { | |
| 8 border-collapse: collapse; | |
| 9 } | |
| 10 thead { | |
| 11 border-top: solid 1px gray; | |
| 12 border-left: solid 1px gray; | |
| 13 } | |
| 14 tbody { | |
| 15 border-top: solid 1px gray; | |
| 16 border-bottom: solid 1px gray; | |
| 17 border-left: solid 1px gray; | |
| 18 } | |
| 19 th { | |
| 20 text-align: center; | |
| 21 border-right: solid 1px gray; | |
| 22 } | |
| 23 td { | |
| 24 text-align: right; | |
| 25 padding-left: 2em; | |
| 26 padding-right: 0.5em; | |
| 27 border-right: solid 1px gray; | |
| 28 } | |
| 29 tr.sep-top { | |
| 30 border-top: solid 1px gray; | |
| 31 } | |
| 32 td.max-value { | |
| 33 color: red; | |
| 34 } | |
| 35 </style> | |
| 36 <script src="js/common.js"></script> | |
| 37 <script> | |
| 38 | |
| 39 function get_index_of_max(ary) { | |
| 40 var max = ary[0]; | |
| 41 var result = 0; | |
| 42 for (var i = 1; i < ary.length; ++i) { | |
| 43 if (ary[i] > max) { | |
| 44 max = ary[i]; | |
| 45 result = i; | |
| 46 } | |
| 47 } | |
| 48 return result; | |
| 49 } | |
| 50 | |
| 51 function received_data(data) { | |
| 52 var tbody = document.getElementById("tbody"); | |
| 53 data.replace('\r', ''); | |
| 54 | |
| 55 var col_sums = []; | |
| 56 | |
| 57 var rows = data.split('\n'); | |
| 58 for (var i = 0; i < rows.length; ++i) { | |
| 59 var tr = document.createElement("TR"); | |
| 60 | |
| 61 var cols = rows[i].split(' '); | |
| 62 | |
| 63 // cols[0] = page name | |
| 64 // cols[1] = mean (minus worst run) | |
| 65 // cols[2] = standard deviation (minus worst run) | |
| 66 // cols[3...] = individual runs | |
| 67 | |
| 68 for (var j = 0; j < cols.length; ++j) { | |
| 69 var td = document.createElement("TD"); | |
| 70 td.appendChild(document.createTextNode(cols[j])); | |
| 71 tr.appendChild(td); | |
| 72 if (j >= 1) { | |
| 73 if (!col_sums[j - 1]) | |
| 74 col_sums[j - 1] = 0; | |
| 75 col_sums[j - 1] = col_sums[j - 1] + (cols[j] - 0); | |
| 76 } | |
| 77 } | |
| 78 | |
| 79 tbody.appendChild(tr); | |
| 80 } | |
| 81 | |
| 82 // print out the column totals (highlight the max value) | |
| 83 | |
| 84 var index_of_max = get_index_of_max(col_sums); | |
| 85 | |
| 86 var tr = document.createElement("TR"); | |
| 87 tr.setAttribute("class", "sep-top"); | |
| 88 | |
| 89 var td = document.createElement("TD"); | |
| 90 td.appendChild(document.createTextNode("column totals")); | |
| 91 tr.appendChild(td); | |
| 92 | |
| 93 for (var j = 0; j < col_sums.length; ++j) { | |
| 94 td = document.createElement("TD"); | |
| 95 // don't display the summation of the stddev column since it is bogus | |
| 96 if (j != 1) { | |
| 97 if (j == index_of_max) | |
| 98 td.setAttribute("class", "max-value"); | |
| 99 var precision = j == 0 ? 2 : 0; | |
| 100 td.appendChild(document.createTextNode(col_sums[j].toFixed(precision))); | |
| 101 } | |
| 102 tr.appendChild(td); | |
| 103 } | |
| 104 | |
| 105 tbody.appendChild(tr); | |
| 106 } | |
| 107 | |
| 108 function init() { | |
| 109 var cl = location.search.substring(4); | |
| 110 Fetch(cl + ".dat", received_data); | |
| 111 } | |
| 112 | |
| 113 window.addEventListener("load", init, false); | |
| 114 </script> | |
| 115 </head> | |
| 116 <body> | |
| 117 <table> | |
| 118 <thead> | |
| 119 <tr><th>Page</th><th>Mean</th><th>StdDev</th><th colspan="10">Runs...</th></
tr> | |
| 120 </thead> | |
| 121 <tbody id="tbody"> | |
| 122 </tbody> | |
| 123 </table> | |
| 124 </body> | |
| 125 </html> | |
| OLD | NEW |