Skip to content

Commit 541dcf1

Browse files
Import inputs into index2.html
1 parent 84ab834 commit 541dcf1

File tree

1 file changed

+102
-15
lines changed

1 file changed

+102
-15
lines changed

site/static/index2.html

Lines changed: 102 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
<!doctype html>
22
<html>
33
<head>
4+
<meta charset="utf-8">
45
<link rel="stylesheet" href="uPlot.min.css">
6+
<link rel="alternate icon" type="image/png" href="/favicon-32x32.png">
7+
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
8+
<link rel="stylesheet" type="text/css" href="perf.css">
59
<style>
610
.uplot {
711
display: inline-block;
@@ -38,10 +42,36 @@
3842
white-space: pre;
3943
font-family: monospace;
4044
}
45+
body {
46+
padding: 1em;
47+
margin: 0;
48+
}
4149
</style>
4250
<script src="uPlot.iife.min.js"></script>
51+
<script src="shared.js"></script>
52+
<title>rustc performance data</title>
4353
</head>
4454
<body>
55+
<div>&gt; <a href="index.html">graphs</a>, <a href="compare.html">compare</a>,
56+
<a href="dashboard.html">dashboard</a>, <a href="status.html">status</a>.</div>
57+
<div id="settings">
58+
start: <input placeholder="yyyy-mm-dd or commit" id="start-bound" />
59+
end: <input placeholder="yyyy-mm-dd or commit" id="end-bound" />
60+
Absolute data: <input id='absolute' name="absolute" type="checkbox">
61+
<select id='stats' name="stat"></select>
62+
<a href="#" onClick="submit_settings(); return false;">Submit</a>
63+
</div>
64+
<div>
65+
See <a href="/compare.html">compare page</a> for descriptions of what
66+
the names mean.
67+
</div>
68+
<div id="loading"><h2>Loading &amp; rendering data..</h2><h3>This may take a while!</h3></div>
69+
<div id="charts"></div>
70+
<div id="as-of"></div>
71+
<a href="https://github.com/rust-lang-nursery/rustc-perf">
72+
<img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png">
73+
</a>
74+
4575
<script>
4676
const seriesColors = ["#7cb5ec", "#434348", "#90ed7d", "#f7a35c", "#8085e9", "#f15c80", "#e4d354", "#2b908f", "#f45b5b", "#91e8e1"];
4777
const interpolatedColor = "#fcb0f1";
@@ -179,11 +209,39 @@
179209
},
180210
],
181211
plugins: [
212+
{
213+
hooks: {
214+
drawAxes: [
215+
u => {
216+
let { ctx } = u;
217+
let { left, top, width, height } = u.bbox;
218+
219+
const interpolatedColorWithAlpha = "#fcb0f15f";
220+
221+
ctx.save();
222+
ctx.strokeStyle = interpolatedColorWithAlpha;
223+
ctx.beginPath();
224+
225+
u.data[0].forEach((v, j) => {
226+
if (isInterpolated(j)) {
227+
let cx = Math.round(u.valToPos(v, 'x', true));
228+
ctx.moveTo(cx, top);
229+
ctx.lineTo(cx, top + height);
230+
}
231+
});
232+
233+
ctx.closePath();
234+
ctx.stroke();
235+
ctx.restore();
236+
},
237+
]
238+
},
239+
},
182240
tooltipPlugin({
183241
onclick(u, seriesIdx, dataIdx) {
184242
let thisCommit = commits[dataIdx][1];
185243
let prevCommit = (commits[dataIdx-1] || [null,null])[1];
186-
window.open(`https://perf.rust-lang.org/compare.html?start=${prevCommit}&end=${thisCommit}&stat=${stat}`);
244+
window.open(`/compare.html?start=${prevCommit}&end=${thisCommit}&stat=${stat}`);
187245
},
188246
commits,
189247
isInterpolated,
@@ -201,7 +259,22 @@
201259
for (let benchKind in benchKinds) {
202260
let cacheStates = benchKinds[benchKind];
203261

204-
let yAxisLabel = i == 0 ? "Value" : null;
262+
let yAxis = "Value";
263+
if (state.stat == "instructions:u") {
264+
yAxis = "Number of CPU instructions";
265+
} else if (state.stat == "cycles:u") {
266+
yAxis = "Number of CPU cycles";
267+
} else if (state.stat == "cpu-clock") {
268+
yAxis = "Wall time execution (seconds)";
269+
} else if (state.stat == "wall-time") {
270+
yAxis = "Wall time execution (seconds)";
271+
} else if (state.stat == "max-rss") {
272+
yAxis = "Maximum resident set size (kb)";
273+
} else if (state.stat == "faults") {
274+
yAxis = "Faults";
275+
}
276+
277+
let yAxisLabel = i == 0 ? yAxis : null;
205278

206279
let seriesOpts = [{}];
207280

@@ -219,7 +292,7 @@
219292
seriesOpts.push({
220293
label: cacheState,
221294
width: devicePixelRatio,
222-
stroke: seriesColors[j],
295+
stroke: seriesColors[j]
223296
});
224297

225298
j++;
@@ -238,19 +311,18 @@
238311
},
239312
});
240313

241-
let u = new uPlot(plotOpts, plotData, document.body);
314+
let u = new uPlot(plotOpts, plotData,
315+
document.querySelector("#charts"));
242316

243317
i++;
244318
}
245319
}
320+
document.querySelector("#loading").style.display = 'none';
246321
}
247322

248-
const BASE_URL = "https://perf.rust-lang.org/perf";
249-
250-
function post(path, body) {
323+
function post_json(path, body) {
251324
return fetch(BASE_URL + path, {
252325
method: "POST",
253-
// headers: {"Content-Type": "application/json"},
254326
body: JSON.stringify(body),
255327
}).then(r => r.json());
256328
}
@@ -282,14 +354,29 @@
282354
return data;
283355
}
284356

285-
const state = {
286-
start: "",
287-
end: "",
288-
stat: "instructions:u",
289-
absolute: true,
290-
};
357+
function submit_settings() {
358+
let start = document.getElementById("start-bound").value;
359+
let end = document.getElementById("end-bound").value;
360+
let absolute = document.getElementById("absolute").checked;
361+
let stat = getSelected("stats");
362+
let params = new URLSearchParams();
363+
params.append("start", start);
364+
params.append("end", end);
365+
params.append("absolute", absolute);
366+
params.append("stat", stat);
367+
window.location.search = params.toString();
368+
}
291369

292-
post("/graph-new", state).then(prepData).then(data => renderPlots(data, state));
370+
load_state(state => {
371+
let values = Object.assign({}, {
372+
start: "",
373+
end: "",
374+
stat: "instructions:u",
375+
absolute: true,
376+
}, state);
377+
post_json("/graph-new", values).then(prepData).then(data =>
378+
renderPlots(data, values));
379+
});
293380
</script>
294381
</body>
295382
</html>

0 commit comments

Comments
 (0)