Skip to content

Commit 0648b6c

Browse files
authored
Merge pull request #1101 from rylev/run-name-scenario
Rename run_name to scenario
2 parents 98f1987 + 5b7c18a commit 0648b6c

File tree

5 files changed

+54
-44
lines changed

5 files changed

+54
-44
lines changed

site/src/api.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,8 @@ pub mod self_profile_raw {
229229
pub struct Request {
230230
pub commit: String,
231231
pub benchmark: String,
232-
pub run_name: String,
232+
#[serde(alias = "run_name")]
233+
pub scenario: String,
233234
pub cid: Option<i32>,
234235
}
235236

@@ -257,7 +258,8 @@ pub mod self_profile_processed {
257258
pub struct Request {
258259
pub commit: String,
259260
pub benchmark: String,
260-
pub run_name: String,
261+
#[serde(alias = "run_name")]
262+
pub scenario: String,
261263
pub cid: Option<i32>,
262264
#[serde(rename = "type")]
263265
pub processor_type: ProcessorType,
@@ -282,7 +284,8 @@ pub mod self_profile {
282284
pub commit: String,
283285
pub base_commit: Option<String>,
284286
pub benchmark: String,
285-
pub run_name: String,
287+
#[serde(alias = "run_name")]
288+
pub scenario: String,
286289
pub sort_idx: String,
287290
}
288291

site/src/request_handlers/self_profile.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ pub async fn handle_self_profile_processed_download(
3838
&diff_against[..std::cmp::min(7, diff_against.len())],
3939
&body.commit[..std::cmp::min(7, body.commit.len())],
4040
body.benchmark,
41-
body.run_name
41+
body.scenario
4242
)
4343
} else {
4444
format!(
4545
"{}: {} {}",
4646
&body.commit[..std::cmp::min(7, body.commit.len())],
4747
body.benchmark,
48-
body.run_name
48+
body.scenario
4949
)
5050
};
5151

@@ -56,7 +56,7 @@ pub async fn handle_self_profile_processed_download(
5656
self_profile_raw::Request {
5757
commit: diff_against,
5858
benchmark: body.benchmark.clone(),
59-
run_name: body.run_name.clone(),
59+
scenario: body.scenario.clone(),
6060
cid: None,
6161
},
6262
ctxt,
@@ -81,7 +81,7 @@ pub async fn handle_self_profile_processed_download(
8181
self_profile_raw::Request {
8282
commit: body.commit,
8383
benchmark: body.benchmark.clone(),
84-
run_name: body.run_name.clone(),
84+
scenario: body.scenario.clone(),
8585
cid: body.cid,
8686
},
8787
ctxt,
@@ -519,7 +519,7 @@ pub async fn handle_self_profile_raw(
519519
let bench_name = it.next().ok_or(format!("no benchmark name"))?;
520520

521521
let scenario = body
522-
.run_name
522+
.scenario
523523
.parse::<database::Scenario>()
524524
.map_err(|e| format!("invalid run name: {:?}", e))?;
525525

@@ -533,7 +533,7 @@ pub async fn handle_self_profile_raw(
533533
}),
534534
bench_name,
535535
profile,
536-
&body.run_name,
536+
&body.scenario,
537537
)
538538
.await;
539539
let (aid, first_cid) = aids_and_cids
@@ -621,7 +621,7 @@ pub async fn handle_self_profile(
621621
let profile = it.next().ok_or(format!("no benchmark type"))?;
622622
let bench_name = it.next().ok_or(format!("no benchmark name"))?;
623623
let scenario = body
624-
.run_name
624+
.scenario
625625
.parse::<database::Scenario>()
626626
.map_err(|e| format!("invalid run name: {:?}", e))?;
627627
let index = ctxt.index.load();
@@ -637,7 +637,7 @@ pub async fn handle_self_profile(
637637
.set(Tag::Profile, selector::Selector::One(profile))
638638
.set(
639639
Tag::Scenario,
640-
selector::Selector::One(body.run_name.clone()),
640+
selector::Selector::One(body.scenario.clone()),
641641
);
642642

643643
let mut commits = vec![index
@@ -703,7 +703,7 @@ pub async fn handle_self_profile(
703703
let conn = ctxt.conn().await;
704704
for commit in commits.iter() {
705705
let aids_and_cids = conn
706-
.list_self_profile(commit.clone(), bench_name, profile, &body.run_name)
706+
.list_self_profile(commit.clone(), bench_name, profile, &body.scenario)
707707
.await;
708708
if let Some((aid, cid)) = aids_and_cids.first() {
709709
match fetch_raw_self_profile_data(*aid, bench_name, profile, scenario, *cid).await {

site/static/compare.html

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,9 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
454454
</tr>
455455
</thead>
456456
<tbody v-if="testCases.length === 0">
457-
<tr><td colspan="6">No results</td></tr>
457+
<tr>
458+
<td colspan="6">No results</td>
459+
</tr>
458460
</tbody>
459461
<tbody v-else>
460462
<template v-for="testCase in testCases">
@@ -644,7 +646,7 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
644646
percent: 100 * (b - a) / a
645647
};
646648
})
647-
.sort((a, b) => Math.abs(b.percent) - Math.abs(a.percent));
649+
.sort((a, b) => Math.abs(b.percent) - Math.abs(a.percent));
648650
},
649651
before() {
650652
if (!this.data) {
@@ -738,10 +740,10 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
738740

739741
},
740742
detailedQueryLink(commit, testCase) {
741-
return `/detailed-query.html?commit=${commit}&benchmark=${testCase.benchmark + "-" + testCase.profile}&run_name=${testCase.scenario}`;
743+
return `/detailed-query.html?commit=${commit}&benchmark=${testCase.benchmark + "-" + testCase.profile}&scenario=${testCase.scenario}`;
742744
},
743745
percentLink(commit, baseCommit, testCase) {
744-
return `/detailed-query.html?commit=${commit}&base_commit=${baseCommit}&benchmark=${testCase.benchmark + "-" + testCase.profile}&run_name=${testCase.scenario}`;
746+
return `/detailed-query.html?commit=${commit}&base_commit=${baseCommit}&benchmark=${testCase.benchmark + "-" + testCase.profile}&scenario=${testCase.scenario}`;
745747
},
746748
commitLink(commit) {
747749
return `https://github.com/rust-lang/rust/commit/${commit}`;
@@ -833,4 +835,4 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
833835
</script>
834836
</body>
835837

836-
</html>
838+
</html>

site/static/detailed-query.html

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -152,28 +152,28 @@ <h4>Artifact Size</h4>
152152
}
153153

154154
function populate_data(data, state) {
155-
let txt = `${state.commit.substring(0, 10)}: Self profile results for ${state.benchmark} run ${state.run_name}`;
155+
let txt = `${state.commit.substring(0, 10)}: Self profile results for ${state.benchmark} run ${state.scenario}`;
156156
if (state.base_commit) {
157157
let self_href =
158-
`/detailed-query.html?sort_idx=${state.sort_idx}&commit=${state.commit}&run_name=${state.run_name}&benchmark=${state.benchmark}`;
158+
`/detailed-query.html?sort_idx=${state.sort_idx}&commit=${state.commit}&scenario=${state.scenario}&benchmark=${state.benchmark}`;
159159
let base_href =
160-
`/detailed-query.html?sort_idx=${state.sort_idx}&commit=${state.base_commit}&run_name=${state.run_name}&benchmark=${state.benchmark}`;
160+
`/detailed-query.html?sort_idx=${state.sort_idx}&commit=${state.base_commit}&scenario=${state.scenario}&benchmark=${state.benchmark}`;
161161
txt += `<br>diff vs base ${state.base_commit.substring(0, 10)}, <a href="${base_href}">query info for just base commit</a>`;
162162
txt += `<br><a href="${self_href}">query info for just this commit</a>`;
163163
}
164164
document.querySelector("#title").innerHTML = txt;
165165
let dl_url = (commit, bench, run) => {
166-
return `/perf/download-raw-self-profile?commit=${commit}&benchmark=${bench}&run_name=${run}`
166+
return `/perf/download-raw-self-profile?commit=${commit}&benchmark=${bench}&scenario=${run}`
167167
};
168168
let dl_link = (commit, bench, run) => {
169169
let url = dl_url(commit, bench, run);
170170
return `<a href="${url}">raw</a>`;
171171
};
172172
let processed_url = (commit, bench, run, ty) => {
173-
return `/perf/processed-self-profile?commit=${commit}&benchmark=${bench}&run_name=${run}&type=${ty}`;
173+
return `/perf/processed-self-profile?commit=${commit}&benchmark=${bench}&scenario=${run}&type=${ty}`;
174174
};
175-
let processed_link = (commit, { benchmark, run_name }, ty) => {
176-
let url = processed_url(commit, benchmark, run_name, ty);
175+
let processed_link = (commit, { benchmark, scenario }, ty) => {
176+
let url = processed_url(commit, benchmark, scenario, ty);
177177
return `<a href="${url}">${ty}</a>`;
178178
};
179179
let processed_crox_url = (commit, bench, run) => {
@@ -194,52 +194,52 @@ <h4>Artifact Size</h4>
194194
txt = "";
195195
if (state.base_commit) {
196196
txt += `Download/view
197-
${dl_link(state.base_commit, state.benchmark, state.run_name)},
197+
${dl_link(state.base_commit, state.benchmark, state.scenario)},
198198
${processed_link(state.base_commit, state, "flamegraph")},
199199
${processed_link(state.base_commit, state, "crox")},
200200
${processed_link(state.base_commit, state, "codegen-schedule")}
201-
(${speedscope_link(state.base_commit, state.benchmark, state.run_name)},
202-
${firefox_profiler_link(state.base_commit, state.benchmark, state.run_name)})
201+
(${speedscope_link(state.base_commit, state.benchmark, state.scenario)},
202+
${firefox_profiler_link(state.base_commit, state.benchmark, state.scenario)})
203203
results for ${state.base_commit.substring(0, 10)} (base commit)`;
204204
txt += "<br>";
205205
}
206206
txt += `Download/view
207-
${dl_link(state.commit, state.benchmark, state.run_name)},
207+
${dl_link(state.commit, state.benchmark, state.scenario)},
208208
${processed_link(state.commit, state, "flamegraph")},
209209
${processed_link(state.commit, state, "crox")},
210210
${processed_link(state.commit, state, "codegen-schedule")}
211-
(${speedscope_link(state.commit, state.benchmark, state.run_name)},
212-
${firefox_profiler_link(state.commit, state.benchmark, state.run_name)})
211+
(${speedscope_link(state.commit, state.benchmark, state.scenario)},
212+
${firefox_profiler_link(state.commit, state.benchmark, state.scenario)})
213213
results for ${state.commit.substring(0, 10)} (new commit)`;
214214
let profile = b => b.endsWith("-opt") ? "Opt" :
215-
b.endsWith("-doc") ? "Doc" :
216-
b.endsWith("-debug") ? "Debug" :
215+
b.endsWith("-doc") ? "Doc" :
216+
b.endsWith("-debug") ? "Debug" :
217217
b.endsWith("-check") ? "Check" : "???";
218218
let bench_name = b => b.replace(/-[^-]*$/, "");
219-
let run_filter = r => r == "full" ? "Full" :
220-
r == "incr-full" ? "IncrFull" :
221-
r == "incr-unchanged" ? "IncrUnchanged" :
222-
r.startsWith("incr-patched") ? "IncrPatched" :
223-
"???";
219+
let scenario_filter = s => s == "full" ? "Full" :
220+
s == "incr-full" ? "IncrFull" :
221+
s == "incr-unchanged" ? "IncrUnchanged" :
222+
s.startsWith("incr-patched") ? "IncrPatched" :
223+
"???";
224224
if (state.base_commit) {
225225
txt += "<br>";
226226
txt += `Diff: <a
227-
href="/perf/processed-self-profile?commit=${state.commit}&base_commit=${state.base_commit}&benchmark=${state.benchmark}&run_name=${state.run_name}&type=codegen-schedule"
227+
href="/perf/processed-self-profile?commit=${state.commit}&base_commit=${state.base_commit}&benchmark=${state.benchmark}&scenario=${state.scenario}&type=codegen-schedule"
228228
>codegen-schedule</a>`;
229229
txt += "<br>Local profile (base): <code>" +
230230
`./target/release/collector profile_local cachegrind
231231
+${state.base_commit} --include ${bench_name(state.benchmark)} --builds
232-
${profile(state.benchmark)} --runs ${run_filter(state.run_name)}</code>`;
232+
${profile(state.benchmark)} --runs ${scenario_filter(state.scenario)}</code>`;
233233
}
234234
txt += "<br>Local profile (new): <code>" +
235235
`./target/release/collector profile_local cachegrind
236236
+${state.commit} --include ${bench_name(state.benchmark)} --builds
237-
${profile(state.benchmark)} --runs ${run_filter(state.run_name)}</code>`;
237+
${profile(state.benchmark)} --runs ${scenario_filter(state.scenario)}</code>`;
238238
if (state.base_commit) {
239-
txt += "<br>Local profile (diff): <code>" +
240-
`./target/release/collector diff_local cachegrind
239+
txt += "<br>Local profile (diff): <code>" +
240+
`./target/release/collector diff_local cachegrind
241241
+${state.base_commit} +${state.commit} --include ${bench_name(state.benchmark)} --builds
242-
${profile(state.benchmark)} --runs ${run_filter(state.run_name)}</code>`;
242+
${profile(state.benchmark)} --runs ${scenario_filter(state.scenario)}</code>`;
243243
}
244244
document.querySelector("#raw-urls").innerHTML = txt;
245245
let sort_idx = state.sort_idx;
@@ -276,7 +276,7 @@ <h4>Artifact Size</h4>
276276
th.innerHTML = `<a href="${query_string_for_state(clickState)}">${inner}</a>`;
277277
}
278278

279-
if (!state.run_name.includes("incr-")) {
279+
if (!state.scenario.includes("incr-")) {
280280
// No need to show incremental columns if not showing
281281
// incremental data.
282282
document.body.classList.add("hide-incr");

site/static/shared.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,11 @@ function loadState(callback, skip_settings) {
197197
let value = param[1];
198198
state[key] = value;
199199
}
200+
// Handle renaming of `run_name` to `scenario`
201+
if (state.run_name && !state.scenario) {
202+
state.scenario = state.run_name;
203+
state.run_name = undefined;
204+
}
200205
if (state.start) {
201206
document.getElementById("start-bound").value = state.start;
202207
}

0 commit comments

Comments
 (0)