lean4-htt/tests/bench/build/lakeprof_report_template.html
Garmelon 08eb78a5b2
chore: switch to new test/bench suite (#12590)
This PR sets up the new integrated test/bench suite. It then migrates
all benchmarks and some related tests to the new suite. There's also
some documentation and some linting.

For now, a lot of the old tests are left alone so this PR doesn't become
even larger than it already is. Eventually, all tests should be migrated
to the new suite though so there isn't a confusing mix of two systems.
2026-02-25 13:51:53 +00:00

74 lines
2.3 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Lakeprof Report</title>
</head>
<body>
<h1>Lakeprof Report</h1>
<button type="button" id="btn_fetch">View build trace in Perfetto</button>
<pre><code>__LAKEPROF_REPORT__</code></pre>
<script type="text/javascript">
// https://perfetto.dev/docs/visualization/deep-linking-to-perfetto-ui
// https://gist.github.com/chromy/170c11ce30d9084957d7f3aa065e89f8
const BASE_URL = __BASE_URL__;
const ORIGIN = "https://ui.perfetto.dev";
const btnFetch = document.getElementById("btn_fetch");
async function fetchAndOpen(traceUrl) {
const resp = await fetch(traceUrl);
// Error checking is left as an exercise to the reader.
const blob = await resp.blob();
const arrayBuffer = await blob.arrayBuffer();
openTrace(arrayBuffer, traceUrl);
}
function openTrace(arrayBuffer, traceUrl) {
const win = window.open(ORIGIN);
if (!win) {
btnFetch.style.background = "#f3ca63";
btnFetch.onclick = () => openTrace(arrayBuffer);
btnFetch.innerText =
"Popups blocked, click here to open the trace file";
return;
}
const timer = setInterval(() => win.postMessage("PING", ORIGIN), 50);
const onMessageHandler = (evt) => {
if (evt.data !== "PONG") return;
// We got a PONG, the UI is ready.
window.clearInterval(timer);
window.removeEventListener("message", onMessageHandler);
const reopenUrl = new URL(location.href);
reopenUrl.hash = `#reopen=${traceUrl}`;
win.postMessage(
{
perfetto: {
buffer: arrayBuffer,
title: "Lake Build Trace",
url: reopenUrl.toString(),
},
},
ORIGIN
);
};
window.addEventListener("message", onMessageHandler);
}
// This is triggered when following the link from the Perfetto UI's sidebar.
if (location.hash.startsWith("#reopen=")) {
const traceUrl = location.hash.substr(8);
fetchAndOpen(traceUrl);
}
btnFetch.onclick = () => fetchAndOpen(`${BASE_URL}/lakeprof.trace_event`);
</script>
</body>
</html>