Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions site/frontend/src/pages/dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@ import {DASHBOARD_DATA_URL} from "../urls";

import {getJson} from "../utils/requests";

type ScaleKind = "linear" | "log";
let scale: ScaleKind = "linear";

const buttons = Array.from(
document.querySelectorAll<HTMLInputElement>("#scale-select-form input")
);

buttons.map((button) => {
button.addEventListener("change", () => {
if (button.checked) {
scale = button.value as ScaleKind;
make_data();
}
});
});

interface DashboardCompileBenchmarkCases {
clean_averages: [number];
base_incr_averages: [number];
Expand Down Expand Up @@ -44,7 +60,8 @@ function render(
},
yAxis: {
title: {text: "Seconds"},
min: 0,
min: scale === "linear" ? 0 : undefined,
type: scale === "log" ? "logarithmic" : undefined,
},
xAxis: {
categories: versions,
Expand Down Expand Up @@ -100,7 +117,8 @@ function renderRuntime(element: string, data: [number], versions: [string]) {
},
yAxis: {
title: {text: "Miliseconds"},
min: 0,
min: scale === "linear" ? 0 : undefined,
type: scale === "log" ? "logarithmic" : undefined,
},
xAxis: {
categories: versions.slice(nullCount),
Expand All @@ -126,8 +144,12 @@ function populate_data(response: DashboardResponse) {
renderRuntime("runtime-average-times", data.runtime, data.versions);
}

let response: DashboardResponse | null = null;
async function make_data() {
const response = await getJson<DashboardResponse>(DASHBOARD_DATA_URL);
if (!response) {
response = await getJson<DashboardResponse>(DASHBOARD_DATA_URL);
}

populate_data(response);
}

Expand Down
11 changes: 11 additions & 0 deletions site/frontend/templates/pages/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@
compiled by a given version of the Rust compiler.
</details>

<form id="scale-select-form">
<label>
<input type="radio" name="scale-select" value="linear" checked />
Linear-scale
</label>
<label>
<input type="radio" name="scale-select" value="log" />
Log-scale
</label>
</form>

<div class="graphs">
<div id="check-average-times"></div>
<div id="debug-average-times"></div>
Expand Down
Loading