1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
<html>
<head>
<style>
.discarded {
color: #C0C0C0;
}
</style>
<h2>Summary</h2>
<dl>
<script src="head.js"></script>
<script>
var __results = true;
var cycles = 0;
var s = document.location.search.substring(1);
var params = s.split('&');
var iterations, pages, totalTime, fudgeTime;
for (var i = 0; i < params.length; ++i) {
var f = params[i].split('=');
switch (f[0]) {
case 'n':
iterations = (f[1] - 0);
break;
case 'i':
cycle = (f[1] - 0);
break;
case 'td':
totalTime = (f[1] - 0);
break;
case 'tf':
fudgeTime = (f[1] - 0);
break;
}
}
var pages = cycle / iterations;
document.write("<table border=1>");
document.write("<tr><td>iterations</td><td>" + iterations + "</td></tr>");
document.write("<tr><td>pages</td><td>" + pages + "</td></tr>");
document.write("<tr><td>milliseconds</td><td>" + totalTime + "</td></tr>");
document.write("<tr><td>mean per set</td><td>" + (totalTime / iterations).toFixed(2) + "</td></tr>");
document.write("<tr><td>mean per page</td><td>" + (totalTime / iterations / pages).toFixed(2) + "</td></tr>");
document.write("<tr><td>timer lag</td><td>" + (fudgeTime).toFixed(2) + "</td></tr>");
document.write("<tr><td>timer lag per page</td><td>" + (fudgeTime / iterations / pages).toFixed(2) + "</td></tr>");
document.write("</table>");
// returns an object with the following properties:
// min : min value of array elements
// max : max value of array elements
// mean : mean value of array elements
// vari : variance computation
// stdd : standard deviation, sqrt(vari)
// indexOfMax : index of max element (the element that is
// removed from the mean computation)
function getArrayStats(ary) {
var r = {};
r.min = ary[0];
r.max = ary[0];
r.indexOfMax = 0;
var sum = 0;
for (var i = 0; i < ary.length; ++i) {
if (ary[i] < r.min) {
r.min = ary[i];
} else if (ary[i] > r.max) {
r.max = ary[i];
r.indexOfMax = i;
}
sum = sum + ary[i];
}
// ignore max value when computing mean and stddev
r.mean = (sum - r.max) / (ary.length - 1);
r.vari = 0;
for (var i = 0; i < ary.length; ++i) {
if (i == r.indexOfMax)
continue;
var d = r.mean - ary[i];
r.vari = r.vari + d * d;
}
r.vari = r.vari / (ary.length - 1);
r.stdd = Math.sqrt(r.vari);
return r;
}
function appendTableCol(tr, text, linkify) {
var doc = tr.ownerDocument;
var td = doc.createElement("TD");
if (linkify) {
var anchor = doc.createElement("A");
anchor.href = text + "/index.html?skip=true";
anchor.appendChild(doc.createTextNode(text));
td.appendChild(anchor);
}
else
td.appendChild(doc.createTextNode(text));
tr.appendChild(td);
return td;
}
function getTimeVals() {
var rawData = __get_timings().split(",");
var timeVals = [];
for (var i = 0; i < iterations; ++i) {
for (var j = 0; j < pages; ++j) {
if (!timeVals[j])
timeVals[j] = [];
timeVals[j].push(parseInt(rawData[j + i*pages]));
}
}
return timeVals;
}
function showReport() {
var tbody = document.getElementById("tbody");
var colsums = [0,0,0,0];
var timeVals = getTimeVals();
for (var i = 0; i < timeVals.length; ++i) {
var tr = document.createElement("TR");
appendTableCol(tr, __pages()[i], true);
var r = getArrayStats(timeVals[i]);
appendTableCol(tr, r.min.toFixed(2));
appendTableCol(tr, r.max.toFixed(2));
appendTableCol(tr, r.mean.toFixed(2));
appendTableCol(tr, r.stdd.toFixed(2));
//appendTableCol(tr, r.chi2.toFixed(2));
for (var j = 0; j < timeVals[i].length; ++j) {
var tv = timeVals[i][j];
var td = appendTableCol(tr, tv);
if (j == r.indexOfMax)
td.setAttribute("class", "discarded");
}
colsums[0] = colsums[0] + r.min;
colsums[1] = colsums[1] + r.max;
colsums[2] = colsums[2] + r.mean;
colsums[3] = colsums[3] + r.stdd;
tbody.appendChild(tr);
}
var tr = document.createElement("TR");
appendTableCol(tr, "totals:");
for (var k = 0; k < colsums.length; ++k)
appendTableCol(tr, colsums[k].toFixed(2));
tbody.appendChild(tr);
}
window.onload = showReport;
</script>
</dl>
</head>
<body>
<h2>Complete Statistics</h2>
<table border="1">
<thead>
<tr>
<th>Site</th>
<th>Min</th>
<th>Max</th>
<th>Mean</th>
<th>Std.d</th>
<th colspan="10">Runs</th>
</tr>
</thead>
<tbody id="tbody"></tbody>
</table>
</body>
</html>
|