Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display non-standard params on summary page #469

Merged
Merged
Show file tree
Hide file tree
Changes from 5 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
17 changes: 17 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,23 @@ <h1>Score</h1>
<div class="section-grid">
<h1 class="section-header">Detailed Results</h1>
<div class="section-content all-metric-results">
<div class="non-standard-params">
<h2>Non-standard Parameters</h2>
<p>
Speedometer ran with non-standard parameters.<br />
The results are likely not comparable to default runs.
</p>
<table id="non-standard-params-table">
<thead>
<tr>
<th>Param</th>
<th>Value</th>
<th>Default</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
<div class="aggregated-metric-result">
<h2>Aggregate Metric</h2>
<div id="geomean-chart"></div>
Expand Down
38 changes: 34 additions & 4 deletions resources/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,40 @@ section#instructions .section-content > * {
flex-direction: column;
}

section#details h1 {
margin-bottom: 10px;
}

section#details .non-standard-params {
display: none;
text-align: center;
margin-bottom: 2em;
}

section#details .non-standard-params h2 {
color: var(--highlight);
}

#non-standard-params-table {
border-collapse: collapse;
text-align: left;
camillobruni marked this conversation as resolved.
Show resolved Hide resolved
display: inline-block;
}
#non-standard-params-table tr {
padding: 2px;
}

#non-standard-params-table thead th {
border-bottom: 1px solid var(--foreground);
padding: 0.1em 0.2em;
}

#non-standard-params-table tbody th {
font-weight: normal;
text-align: left;
padding: 0.1em 0.2em;
}

section#details .all-metric-results {
flex: auto;
overflow-y: auto;
Expand All @@ -513,10 +547,6 @@ section#details .arithmetic-mean > label {
margin-right: 10px;
}

section#details h1 {
margin-bottom: 10px;
}

section#details .metric {
margin: 0px 0 10px 0;
display: inline-block;
Expand Down
30 changes: 29 additions & 1 deletion resources/main.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { BenchmarkRunner } from "./benchmark-runner.mjs";
import * as Statistics from "./statistics.mjs";
import { Suites } from "./tests.mjs";
import { renderMetricView } from "./metric-ui.mjs";
import { params } from "./shared/params.mjs";
import { defaultParams, params } from "./shared/params.mjs";
import { createDeveloperModeContainer } from "./developer-mode.mjs";

// FIXME(camillobruni): Add base class
Expand Down Expand Up @@ -243,6 +243,7 @@ class MainBenchmarkClient {
}

_populateDetailedResults(metrics) {
this._populateNonStandardParams();
const trackHeight = 24;
document.documentElement.style.setProperty("--metrics-line-height", `${trackHeight}px`);
const plotWidth = (params.viewport.width - 120) / 2;
Expand Down Expand Up @@ -290,6 +291,33 @@ class MainBenchmarkClient {
csvLink.setAttribute("download", `${filePrefix}.csv`);
}

_populateNonStandardParams() {
if (params === defaultParams)
return;
const paramsDiff = [];
const usedSearchparams = params.toSearchParamsObject();
const defaultSearchParams = defaultParams.toCompleteSearchParamsObject(false);
for (const [key, value] of usedSearchparams.entries()) {
if (key === "developerMode")
continue;
const defaultValue = defaultSearchParams.get(key);
if (value !== defaultValue)
paramsDiff.push({ key, value, defaultValue });
}
if (paramsDiff.length === 0)
return;
const body = document.createElement("tbody");
for (const { key, value, defaultValue } of paramsDiff) {
const row = body.insertRow(-1);
camillobruni marked this conversation as resolved.
Show resolved Hide resolved
row.insertCell().textContent = key;
row.insertCell().textContent = value;
row.insertCell().textContent = defaultValue;
}
const table = document.getElementById("non-standard-params-table");
table.replaceChild(body, table.tBodies[0]);
document.querySelector(".non-standard-params").style.display = "block";
}

prepareUI() {
window.addEventListener("hashchange", this._hashChangeHandler.bind(this));
window.addEventListener("resize", this._resizeScreeHandler.bind(this));
Expand Down
2 changes: 1 addition & 1 deletion resources/newssite/news-next/dist/404.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="./_next/static/css/a0dca1379a01e5cf.css" as="style"/><link rel="stylesheet" href="./_next/static/css/a0dca1379a01e5cf.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="./_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="./_next/static/chunks/webpack-e50e9853db18b759.js" defer=""></script><script src="./_next/static/chunks/framework-2c79e2a64abdb08b.js" defer=""></script><script src="./_next/static/chunks/main-2ba37e62325cc71b.js" defer=""></script><script src="./_next/static/chunks/pages/_app-77983e68be50f72a.js" defer=""></script><script src="./_next/static/chunks/pages/_error-54de1933a164a1ff.js" defer=""></script><script src="./_next/static/tdun_naEsLSWD7CGin1GQ/_buildManifest.js" defer=""></script><script src="./_next/static/tdun_naEsLSWD7CGin1GQ/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><div id="settings-container"></div><div id="notifications-container"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"tdun_naEsLSWD7CGin1GQ","assetPrefix":".","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="./_next/static/css/a0dca1379a01e5cf.css" as="style"/><link rel="stylesheet" href="./_next/static/css/a0dca1379a01e5cf.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="./_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="./_next/static/chunks/webpack-e50e9853db18b759.js" defer=""></script><script src="./_next/static/chunks/framework-2c79e2a64abdb08b.js" defer=""></script><script src="./_next/static/chunks/main-2ba37e62325cc71b.js" defer=""></script><script src="./_next/static/chunks/pages/_app-4fe6038a10d156ec.js" defer=""></script><script src="./_next/static/chunks/pages/_error-54de1933a164a1ff.js" defer=""></script><script src="./_next/static/slmX88Sy3MO0SLK8cVHnz/_buildManifest.js" defer=""></script><script src="./_next/static/slmX88Sy3MO0SLK8cVHnz/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><div id="settings-container"></div><div id="notifications-container"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"slmX88Sy3MO0SLK8cVHnz","assetPrefix":".","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these getting re-generated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to run npm install; npm run build in the news-next workload since shared/params.mjs has changed and it's included as a package in that workload.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, that's unfortunate.

Large diffs are not rendered by default.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

This file was deleted.

This file was deleted.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

2 changes: 1 addition & 1 deletion resources/newssite/news-next/dist/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="./_next/static/css/a0dca1379a01e5cf.css" as="style"/><link rel="stylesheet" href="./_next/static/css/a0dca1379a01e5cf.css" data-n-g=""/><link rel="preload" href="./_next/static/css/2cf5163b53bb0adb.css" as="style"/><link rel="stylesheet" href="./_next/static/css/2cf5163b53bb0adb.css" data-n-p=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="./_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="./_next/static/chunks/webpack-e50e9853db18b759.js" defer=""></script><script src="./_next/static/chunks/framework-2c79e2a64abdb08b.js" defer=""></script><script src="./_next/static/chunks/main-2ba37e62325cc71b.js" defer=""></script><script src="./_next/static/chunks/pages/_app-77983e68be50f72a.js" defer=""></script><script src="./_next/static/chunks/743-fd706aeabb7828e3.js" defer=""></script><script src="./_next/static/chunks/pages/index-ca407dccff56c060.js" defer=""></script><script src="./_next/static/tdun_naEsLSWD7CGin1GQ/_buildManifest.js" defer=""></script><script src="./_next/static/tdun_naEsLSWD7CGin1GQ/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><div id="settings-container"></div><div id="notifications-container"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"tdun_naEsLSWD7CGin1GQ","assetPrefix":".","nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="./_next/static/css/a0dca1379a01e5cf.css" as="style"/><link rel="stylesheet" href="./_next/static/css/a0dca1379a01e5cf.css" data-n-g=""/><link rel="preload" href="./_next/static/css/69253d842fd3fbfd.css" as="style"/><link rel="stylesheet" href="./_next/static/css/69253d842fd3fbfd.css" data-n-p=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="./_next/static/chunks/polyfills-c67a75d1b6f99dc8.js"></script><script src="./_next/static/chunks/webpack-e50e9853db18b759.js" defer=""></script><script src="./_next/static/chunks/framework-2c79e2a64abdb08b.js" defer=""></script><script src="./_next/static/chunks/main-2ba37e62325cc71b.js" defer=""></script><script src="./_next/static/chunks/pages/_app-4fe6038a10d156ec.js" defer=""></script><script src="./_next/static/chunks/553-29fd8c03a09c7b37.js" defer=""></script><script src="./_next/static/chunks/pages/index-7052462c4e106c39.js" defer=""></script><script src="./_next/static/slmX88Sy3MO0SLK8cVHnz/_buildManifest.js" defer=""></script><script src="./_next/static/slmX88Sy3MO0SLK8cVHnz/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><div id="settings-container"></div><div id="notifications-container"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/","query":{},"buildId":"slmX88Sy3MO0SLK8cVHnz","assetPrefix":".","nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script></body></html>
61 changes: 11 additions & 50 deletions resources/newssite/news-next/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 14 additions & 8 deletions resources/shared/params.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,14 @@ export class Params {
return shuffleSeed;
}

toSearchParamsObject() {
toCompleteSearchParamsObject() {
return this.toSearchParamsObject(false);
}

toSearchParamsObject(filter = true) {
const rawParams = { __proto__: null };
for (const [key, value] of Object.entries(this)) {
if (value === defaultParams[key])
if (filter && value === defaultParams[key])
continue;
rawParams[key] = value;
}
Expand All @@ -169,11 +173,13 @@ export class Params {

export const defaultParams = new Params();

const searchParams = new URLSearchParams(typeof window !== "undefined" ? window.location.search : undefined);
let maybeCustomParams = new Params();
try {
maybeCustomParams = new Params(searchParams);
} catch (e) {
console.error("Invalid URL Param", e, "\nUsing defaults as fallback:", maybeCustomParams);
let maybeCustomParams = defaultParams;
if (globalThis?.location?.search) {
const searchParams = new URLSearchParams(globalThis.location.search);
try {
maybeCustomParams = new Params(searchParams);
} catch (e) {
console.error("Invalid URL Param", e, "\nUsing defaults as fallback:", maybeCustomParams);
}
}
export const params = maybeCustomParams;