OLD | NEW |
| (Empty) |
1 <html> | |
2 | |
3 <!-- | |
4 Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | |
5 Use of this source code is governed by a BSD-style license that can be | |
6 found in the LICENSE file. | |
7 --> | |
8 | |
9 <head> | |
10 <style> | |
11 table { | |
12 font-family: monospace; | |
13 border-collapse: collapse; | |
14 } | |
15 thead { | |
16 border-top: solid 1px gray; | |
17 border-left: solid 1px gray; | |
18 } | |
19 tbody { | |
20 border-top: solid 1px gray; | |
21 border-bottom: solid 1px gray; | |
22 border-left: solid 1px gray; | |
23 } | |
24 th { | |
25 text-align: center; | |
26 border-right: solid 1px gray; | |
27 } | |
28 td { | |
29 text-align: right; | |
30 padding-left: 2em; | |
31 padding-right: 0.5em; | |
32 border-right: solid 1px gray; | |
33 } | |
34 tr.sep { | |
35 border-top: solid 1px gray; | |
36 border-bottom: solid 1px gray; | |
37 } | |
38 td.max-value { | |
39 color: red; | |
40 } | |
41 </style> | |
42 <script src="js/common.js"></script> | |
43 <script> | |
44 function get_index_of_max(ary) { | |
45 var max = ary[0]; | |
46 var result = 0; | |
47 for (var i = 1; i < ary.length; ++i) { | |
48 if (ary[i] > max) { | |
49 max = ary[i]; | |
50 result = i; | |
51 } | |
52 } | |
53 return result; | |
54 } | |
55 | |
56 function append_column(tr, value, sums, index) { | |
57 td = document.createElement("TD"); | |
58 td.appendChild(document.createTextNode(value)); | |
59 tr.appendChild(td); | |
60 | |
61 if (index >= 0) { | |
62 if (!sums[index]) | |
63 sums[index] = 0; | |
64 sums[index] += parseFloat(value); | |
65 } | |
66 } | |
67 | |
68 function received_data(data) { | |
69 var tbody = document.getElementById("tbody"); | |
70 data.replace('\r', ''); | |
71 | |
72 var col_sums = []; | |
73 var rows = data.split('\n'); | |
74 var num_rows = 0; | |
75 | |
76 for (var i = 0; i < rows.length; ++i) { | |
77 var tr = document.createElement("TR"); | |
78 var cols = rows[i].split(' '); | |
79 | |
80 // cols[0] = page name | |
81 // cols[1] = (mean+/-standard deviation): | |
82 // cols[2...] = individual runs | |
83 // Require at least the page name and statistics. | |
84 if (cols.length < 2) | |
85 continue; | |
86 | |
87 var page = cols[0]; | |
88 var values = cols[1].split('+/-'); | |
89 append_column(tr, page, col_sums, -1); | |
90 append_column(tr, values[0].slice(1), col_sums, 0); | |
91 append_column(tr, values[1].slice(0,-2), col_sums, 1); | |
92 | |
93 for (var j = 2; j < cols.length; ++j) | |
94 append_column(tr, cols[j], col_sums, j); | |
95 | |
96 tbody.appendChild(tr); | |
97 num_rows++; | |
98 } | |
99 | |
100 // print out the column totals (highlight the max value) | |
101 var index_of_max = get_index_of_max(col_sums); | |
102 | |
103 var tr = document.createElement("TR"); | |
104 tr.setAttribute("class", "sep"); | |
105 | |
106 var td = document.createElement("TD"); | |
107 td.appendChild(document.createTextNode("column totals")); | |
108 tr.appendChild(td); | |
109 | |
110 for (var j = 0; j < col_sums.length; ++j) { | |
111 td = document.createElement("TD"); | |
112 // don't display the summation of the stddev column since it is bogus | |
113 if (j != 1) { | |
114 if (j == index_of_max) | |
115 td.setAttribute("class", "max-value"); | |
116 var precision = j == 0 ? 2 : 0; | |
117 td.appendChild(document.createTextNode(col_sums[j].toFixed(precision))); | |
118 } | |
119 tr.appendChild(td); | |
120 } | |
121 | |
122 tbody.appendChild(tr); | |
123 | |
124 // print out the column averages | |
125 var tr = document.createElement("TR"); | |
126 tr.setAttribute("class", "sep"); | |
127 | |
128 var td = document.createElement("TD"); | |
129 td.appendChild(document.createTextNode("column averages")); | |
130 tr.appendChild(td); | |
131 | |
132 for (var j = 0; j < col_sums.length; ++j) { | |
133 td = document.createElement("TD"); | |
134 // don't display the average of the stddev column since it is bogus | |
135 if (j != 1) { | |
136 var precision = 2; | |
137 td.appendChild(document.createTextNode( | |
138 (col_sums[j]/num_rows).toFixed(precision))); | |
139 } | |
140 tr.appendChild(td); | |
141 } | |
142 | |
143 tbody.appendChild(tr); | |
144 } | |
145 | |
146 function init() { | |
147 var params = ParseParams(); | |
148 var graph = params.graph ? params.graph + "_" : ""; | |
149 var cl = params.cl; | |
150 var traces = []; | |
151 for (var trace in params.trace) { | |
152 // Try to fetch both files, because page cycler and frame rate have | |
153 // have different output files (this should be fixed). | |
154 Fetch(cl + "_" + trace + ".dat", received_data); | |
155 Fetch(cl + "_" + graph + trace + ".dat", received_data); | |
156 traces.push(trace); | |
157 } | |
158 if (traces.length > 0) | |
159 document.getElementById("description").innerText = traces + " in r" + cl; | |
160 } | |
161 | |
162 window.addEventListener("load", init, false); | |
163 </script> | |
164 </head> | |
165 <body> | |
166 <div id="description"></div> | |
167 <table> | |
168 <thead> | |
169 <tr><th>Data</th><th>Mean</th><th>StdDev</th><th colspan="10">Runs...</th></
tr> | |
170 </thead> | |
171 <tbody id="tbody"> | |
172 </tbody> | |
173 </table> | |
174 </body> | |
175 </html> | |
OLD | NEW |