Skip to content

Commit

Permalink
suite check boxes
Browse files Browse the repository at this point in the history
  • Loading branch information
oflatt committed Feb 7, 2025
1 parent ba77631 commit 13cdf16
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 21 deletions.
12 changes: 6 additions & 6 deletions infra/nightly-resources/chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,17 @@ function getError(entry) {
}

function parseDataForChart() {
const benchmarks = GLOBAL_DATA.enabledBenchmarks;
const benchmarks = enabledBenchmarks();
const sortByMode = GLOBAL_DATA.chart.sortBy;
let sortedBenchmarks = Array.from(benchmarks).sort();

const data = {};
// First, compute value and error for each mode and benchmark
GLOBAL_DATA.enabledModes.forEach((mode) => {
GLOBAL_DATA.checkedModes.forEach((mode) => {
data[mode] = {};
benchmarks.forEach((benchmark) => {
const entry = getEntry(benchmark, mode);
if (entry && GLOBAL_DATA.enabledSuites.has(entry.suite)) {
if (entry) {
data[mode][benchmark] = {
mode: mode,
benchmark: benchmark,
Expand All @@ -137,11 +137,11 @@ function parseDataForChart() {
// ChartJS wants the data formatted so that there's an array of values for each mode
// and a corresponding array of labels (benchmarks)
const datasets = {};
GLOBAL_DATA.enabledModes.forEach((mode) => {
GLOBAL_DATA.checkedModes.forEach((mode) => {
datasets[mode] = {
label: mode,
backgroundColor: COLORS[mode],
data: Array(benchmarks.size).fill(0),
data: Array(benchmarks.length).fill(0),
borderWidth: 1,
errorBars: {},
};
Expand All @@ -162,7 +162,7 @@ function parseDataForChart() {
if (GLOBAL_DATA.chart.mode === "normalized") {
datasets[BASELINE_MODE] = {
label: BASELINE_MODE,
data: Array(benchmarks.size + 1).fill(1),
data: Array(benchmarks.length + 1).fill(1),
type: "line",
borderColor: COLORS[BASELINE_MODE],
fill: false,
Expand Down
4 changes: 2 additions & 2 deletions infra/nightly-resources/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function getOverallStatistics() {
for (const treatment of treatments) {
const normalized_cycles = [];
// for each benchmark, calculate the normalized cycles
for (const benchmark of GLOBAL_DATA.enabledBenchmarks) {
for (const benchmark of enabledBenchmarks()) {
const row = getRow(benchmark, treatment);
const baseline = getRow(benchmark, BASELINE_MODE);
if (row && baseline) {
Expand All @@ -86,7 +86,7 @@ function getOverallStatistics() {

const eggcc_compile_times = [];
const llvm_compile_times = [];
for (const benchmark of GLOBAL_DATA.enabledBenchmarks) {
for (const benchmark of enabledBenchmarks()) {
const row = getRow(benchmark, treatment);
eggcc_compile_times.push(row.eggccCompileTimeSecs);
llvm_compile_times.push(row.llvmCompileTimeSecs);
Expand Down
10 changes: 5 additions & 5 deletions infra/nightly-resources/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function selectAllSuites() {
Array.from(checkboxContainer.getElementsByTagName("input")).forEach(
(checkbox) => {
checkbox.checked = true;
GLOBAL_DATA.enabledSuites.add(checkbox.id);
GLOBAL_DATA.checkedSuites.add(checkbox.id);
},
);
refreshView();
Expand All @@ -73,8 +73,8 @@ function selectAllModes(enabled) {
(checkbox) => {
checkbox.checked = enabled;
enabled
? GLOBAL_DATA.enabledModes.add(checkbox.id)
: GLOBAL_DATA.enabledModes.delete(checkbox.id);
? GLOBAL_DATA.checkedModes.add(checkbox.id)
: GLOBAL_DATA.checkedModes.delete(checkbox.id);
},
);
refreshView();
Expand Down Expand Up @@ -117,8 +117,8 @@ function selectBenchmarks(category) {
}
checkboxes.forEach((checkbox) => {
checkbox.checked
? GLOBAL_DATA.enabledBenchmarks.add(checkbox.id)
: GLOBAL_DATA.enabledBenchmarks.delete(checkbox.id);
? GLOBAL_DATA.checkedBenchmarks.add(checkbox.id)
: GLOBAL_DATA.checkedBenchmarks.delete(checkbox.id);
});
refreshView();
}
Expand Down
3 changes: 3 additions & 0 deletions infra/nightly-resources/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ <h2>Nightlies</h2>
<button onclick="selectAllModes(false)">Select None</button>
</div>
<div id="modeCheckboxes"></div>
<div>
<p>Benchmark Suites</p>
</div>
<div id="suiteCheckboxes"></div>
</div>
<div class="filters">
Expand Down
32 changes: 24 additions & 8 deletions infra/nightly-resources/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ const treatments = [
];

const GLOBAL_DATA = {
enabledModes: new Set(),
enabledSuites: new Set(),
enabledBenchmarks: new Set(),
checkedModes: new Set(),
checkedSuites: new Set(),
checkedBenchmarks: new Set(),
warnings: new Set(),
currentRun: [],
baselineRun: [],
Expand All @@ -26,6 +26,22 @@ const GLOBAL_DATA = {
},
};

// filter to all the benchmark names that are enabled
// using checkedSuites and checkedBenchmarks
function enabledBenchmarks() {
return Array.from(GLOBAL_DATA.checkedBenchmarks).filter((benchmark) =>
GLOBAL_DATA.checkedSuites.has(getRow(benchmark, BASELINE_MODE).suite))
}

// filter current run for enabled benchmarks
// and by checked run modes
function enabledSubsetOfCurrentRun() {
const benchmarks = enabledBenchmarks();
return GLOBAL_DATA.currentRun.filter((entry) =>
GLOBAL_DATA.checkedModes.has(entry.runMethod) && benchmarks.includes(entry),
);
}

function addWarning(warning) {
GLOBAL_DATA.warnings.add(warning);
}
Expand Down Expand Up @@ -67,7 +83,7 @@ function addTableTo(element, data, title) {

function tableForSuite(suite) {
const byBench = {};
Array.from(GLOBAL_DATA.enabledBenchmarks)
Array.from(GLOBAL_DATA.checkedBenchmarks)
.filter((benchmark) => getRow(benchmark, BASELINE_MODE).suite === suite)
.forEach((benchmark) => {
byBench[benchmark] = getDataForBenchmark(benchmark);
Expand All @@ -88,7 +104,7 @@ function dedup(arr) {
}

function getSuites() {
return dedup(GLOBAL_DATA.currentRun).map((benchmark) => benchmark.suite);
return dedup(GLOBAL_DATA.currentRun.map((benchmark) => benchmark.suite));
}


Expand Down Expand Up @@ -160,7 +176,7 @@ function makeSelectors() {
document.getElementById("modeCheckboxes"),
mode,
);
checkbox.onchange = () => toggleCheckbox(mode, GLOBAL_DATA.enabledModes);
checkbox.onchange = () => toggleCheckbox(mode, GLOBAL_DATA.checkedModes);
});

const suites = getSuites();
Expand All @@ -169,7 +185,7 @@ function makeSelectors() {
document.getElementById("suiteCheckboxes"),
suite,
);
checkbox.onchange = () => toggleCheckbox(suite, GLOBAL_DATA.enabledSuites);
checkbox.onchange = () => toggleCheckbox(suite, GLOBAL_DATA.checkedSuites);
});

const benchmarks = Array.from(
Expand All @@ -181,7 +197,7 @@ function makeSelectors() {
benchmark,
);
checkbox.onchange = () =>
toggleCheckbox(benchmark, GLOBAL_DATA.enabledBenchmarks);
toggleCheckbox(benchmark, GLOBAL_DATA.checkedBenchmarks);
});
}

Expand Down

0 comments on commit 13cdf16

Please sign in to comment.