From 0b8b72f081d7e528d223597f301c9ac54d54845e Mon Sep 17 00:00:00 2001 From: Anjali Pal Date: Tue, 11 Jun 2024 21:15:04 -0700 Subject: [PATCH] link bril --- infra/nightly-resources/data.js | 8 ++++ infra/nightly-resources/handlers.js | 2 +- infra/nightly-resources/index.js | 2 +- infra/nightly-resources/llvm.html | 4 +- infra/nightly-resources/table.js | 59 +++++++++++++---------------- infra/profile.py | 10 ++--- 6 files changed, 44 insertions(+), 41 deletions(-) diff --git a/infra/nightly-resources/data.js b/infra/nightly-resources/data.js index e814ff772..97cf9d84c 100644 --- a/infra/nightly-resources/data.js +++ b/infra/nightly-resources/data.js @@ -39,6 +39,14 @@ function shouldHaveLlvm(runMethod) { ].includes(runMethod); } +function getBrilPathForBenchmark(benchmark) { + const o = GLOBAL_DATA.currentRun.find(o => o.benchmark === benchmark); + if (!o) { + console.error(`couldn't find entry for ${benchmark} (this shouldn't happen)`); + } + return o.metadata.path; +} + function getDataForBenchmark(benchmark) { const executions = GLOBAL_DATA.currentRun ?.filter((o) => o.benchmark === benchmark) diff --git a/infra/nightly-resources/handlers.js b/infra/nightly-resources/handlers.js index dd156e893..7900442df 100644 --- a/infra/nightly-resources/handlers.js +++ b/infra/nightly-resources/handlers.js @@ -68,7 +68,7 @@ function selectAllBenchmarks(enabled, category) { let checkboxes = Array.from(checkboxContainer.getElementsByTagName("input")); if (category === "looped") { const loopedBenchmarks = new Set( - GLOBAL_DATA.currentRun.filter((x) => x.looped).map((x) => x.benchmark), + GLOBAL_DATA.currentRun.filter((x) => x.metadata.looped).map((x) => x.benchmark), ); checkboxes = checkboxes.filter((x) => loopedBenchmarks.has(x.id)); } diff --git a/infra/nightly-resources/index.js b/infra/nightly-resources/index.js index 06af0a1ac..4a3b48c63 100644 --- a/infra/nightly-resources/index.js +++ b/infra/nightly-resources/index.js @@ -39,7 +39,7 @@ function refreshView() { byBench[benchmark] = getDataForBenchmark(benchmark); }); const tableData = Object.keys(byBench).map((bench) => ({ - name: bench, + name: `${bench}`, executions: { data: byBench[bench] }, })); tableData.sort((l, r) => l.name - r.name); diff --git a/infra/nightly-resources/llvm.html b/infra/nightly-resources/llvm.html index 9edb9d41b..98a971c65 100644 --- a/infra/nightly-resources/llvm.html +++ b/infra/nightly-resources/llvm.html @@ -15,8 +15,8 @@

LLVM

- -
+ +
diff --git a/infra/nightly-resources/table.js b/infra/nightly-resources/table.js index be83aae14..27b53f58b 100644 --- a/infra/nightly-resources/table.js +++ b/infra/nightly-resources/table.js @@ -121,42 +121,37 @@ function ConvertJsonToTable( var value = parsedJson[i][headers[j]]; var isUrl = urlRegExp.test(value) || javascriptRegExp.test(value); - if (isUrl) - // If value is URL we auto-create a link - tbCon += tdRow.format(link.format(value)); - else { - if (value) { - if (typeof value == "object") { - // special case for adding class to elts: - // if the value has exactly the form {class: ..., value: ...} - // treat it as just value.value, and set the class of the element to value.class - if ( - Object.keys(value).length === 2 && - value.hasOwnProperty("value") && - value.hasOwnProperty("class") - ) { - tbCon += '{1}'.format( - value.class, - value.value, - ); - } else { - //for supporting nested tables - tbCon += tdRow.format( - ConvertJsonToTable( - eval(value.data), - value.tableId, - value.tableClassName, - value.linkText, - ), - ); - } + if (value) { + if (typeof value == "object") { + // special case for adding class to elts: + // if the value has exactly the form {class: ..., value: ...} + // treat it as just value.value, and set the class of the element to value.class + if ( + Object.keys(value).length === 2 && + value.hasOwnProperty("value") && + value.hasOwnProperty("class") + ) { + tbCon += '{1}'.format( + value.class, + value.value, + ); } else { - tbCon += tdRow.format(value); + //for supporting nested tables + tbCon += tdRow.format( + ConvertJsonToTable( + eval(value.data), + value.tableId, + value.tableClassName, + value.linkText, + ), + ); } } else { - // If value == null we format it like PhpMyAdmin NULL values - tbCon += tdRow.format(italic.format(value).toUpperCase()); + tbCon += tdRow.format(value); } + } else { + // If value == null we format it like PhpMyAdmin NULL values + tbCon += tdRow.format(italic.format(value).toUpperCase()); } } trCon += tr.format(tbCon); diff --git a/infra/profile.py b/infra/profile.py index d227df87c..9e057fdfb 100755 --- a/infra/profile.py +++ b/infra/profile.py @@ -105,13 +105,13 @@ def should_have_llvm_ir(runMethod): ] # aggregate all profile info into a single json array. -def aggregate(compile_times, bench_times, looped): +def aggregate(compile_times, bench_times, benchmark_metadata): res = [] for path in sorted(compile_times.keys()): name = path.split("/")[-2] runMethod = path.split("/")[-1] - result = {"runMethod": runMethod, "benchmark": name, "hyperfine": bench_times[path], "compileTime": compile_times[path], "looped": looped[name]} + result = {"runMethod": runMethod, "benchmark": name, "hyperfine": bench_times[path], "compileTime": compile_times[path], "metadata": benchmark_metadata[name]} res.append(result) return res @@ -142,10 +142,10 @@ def is_looped(bril_file): else: profiles = [bril_dir] - looped = {} + benchmark_metadata = {} for profile in profiles: name = profile.split("/")[-1][:-len(".bril")] - looped[name] = is_looped(profile) + benchmark_metadata[name] = {"looped": is_looped(profile), "path": profile} to_run = [] index = 0 @@ -190,7 +190,7 @@ def is_looped(bril_file): (path, _bench_data) = res bench_data[path] = _bench_data - nightly_data = aggregate(compile_times, bench_data, looped) + nightly_data = aggregate(compile_times, bench_data, benchmark_metadata) with open(f"{DATA_DIR}/profile.json", "w") as profile: json.dump(nightly_data, profile, indent=2)