Skip to content

Commit c342aaf

Browse files
committed
add runtime bench chart to the dashboard
1 parent 8eb7b0f commit c342aaf

File tree

4 files changed

+87
-21
lines changed

4 files changed

+87
-21
lines changed

site/frontend/src/pages/dashboard.ts

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {DASHBOARD_DATA_URL} from "../urls";
33

44
import {getJson} from "../utils/requests";
55

6-
interface DashboardCases {
6+
interface DashboardCompileBenchmarkCases {
77
clean_averages: [number];
88
base_incr_averages: [number];
99
clean_incr_averages: [number];
@@ -13,10 +13,11 @@ interface DashboardCases {
1313
interface DashboardResponse {
1414
Ok: {
1515
versions: [string];
16-
check: DashboardCases;
17-
debug: DashboardCases;
18-
opt: DashboardCases;
19-
doc: DashboardCases;
16+
check: DashboardCompileBenchmarkCases;
17+
debug: DashboardCompileBenchmarkCases;
18+
opt: DashboardCompileBenchmarkCases;
19+
doc: DashboardCompileBenchmarkCases;
20+
runtime: [number];
2021
};
2122
}
2223

@@ -25,7 +26,7 @@ type Profile = "check" | "debug" | "opt" | "doc";
2526
function render(
2627
element: string,
2728
name: Profile,
28-
data: DashboardCases,
29+
data: DashboardCompileBenchmarkCases,
2930
versions: [string]
3031
) {
3132
let articles = {check: "a", debug: "a", opt: "an", doc: "a"};
@@ -78,12 +79,44 @@ function render(
7879
});
7980
}
8081

82+
function renderRuntime(element: string, data: [number], versions: [string]) {
83+
Highcharts.chart({
84+
chart: {
85+
renderTo: element,
86+
zooming: {
87+
type: "xy",
88+
},
89+
type: "line",
90+
},
91+
title: {
92+
text: `Average time for a run`,
93+
},
94+
yAxis: {
95+
title: {text: "Seconds"},
96+
min: 0,
97+
},
98+
xAxis: {
99+
categories: versions,
100+
title: {text: "Version"},
101+
},
102+
series: [
103+
{
104+
showInLegend: false,
105+
type: "line",
106+
animation: false,
107+
data,
108+
},
109+
],
110+
});
111+
}
112+
81113
function populate_data(response: DashboardResponse) {
82114
const data = response.Ok;
83115
render("check-average-times", "check", data.check, data.versions);
84116
render("debug-average-times", "debug", data.debug, data.versions);
85117
render("opt-average-times", "opt", data.opt, data.versions);
86118
render("doc-average-times", "doc", data.doc, data.versions);
119+
renderRuntime("runtime-average-times", data.runtime, data.versions);
87120
}
88121

89122
async function make_data() {
Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,36 @@
11
{% extends "layout.html" %}
2+
{% block head %}
3+
<style>
4+
.graphs {
5+
display: grid;
6+
grid-template-columns: repeat(2, 1fr);
7+
8+
@media screen and (max-width: 768px) {
9+
grid-template-columns: 1fr;
10+
}
11+
}
12+
</style>
13+
{% endblock %}
214
{% block content %}
315
<details style="margin-top: 10px;">
4-
<summary>What data is in the dashboard?</summary>
16+
<summary>What data is in the dashboard?</summary>
517

6-
The dashboard shows performance results for all stable Rust releases going back to
7-
<code>1.28.0</code>, along with the latest <code>beta</code> release. The displayed
8-
duration is an arithmetic mean amongst all
9-
<a href="https://github.com/rust-lang/rustc-perf/tree/master/collector/compile-benchmarks#stable">stable</a>
10-
benchmarks.
18+
The dashboard shows performance results for all stable Rust releases going back to
19+
<code>1.28.0</code>, along with the latest <code>beta</code> release. The displayed
20+
duration is an arithmetic mean amongst all
21+
<a href="https://github.com/rust-lang/rustc-perf/tree/master/collector/compile-benchmarks#stable">stable</a>
22+
benchmarks.
1123
</details>
1224

13-
<div id="check-average-times"></div>
14-
<div id="debug-average-times"></div>
15-
<div id="opt-average-times"></div>
16-
<div id="doc-average-times"></div>
25+
<div class="graphs">
26+
<div id="check-average-times"></div>
27+
<div id="debug-average-times"></div>
28+
<div id="opt-average-times"></div>
29+
<div id="doc-average-times"></div>
30+
<div id="runtime-average-times"></div>
31+
</div>
1732
<div id="as-of"></div>
1833
{% endblock %}
1934
{% block script %}
2035
<script src="scripts/dashboard.js"></script>
21-
{% endblock %}
36+
{% endblock %}

site/src/api.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ pub mod dashboard {
7575
pub debug: Cases,
7676
pub opt: Cases,
7777
pub doc: Cases,
78+
pub runtime: Vec<f64>,
7879
}
7980
}
8081

site/src/request_handlers/dashboard.rs

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,22 +82,25 @@ pub async fn handle_dashboard(ctxt: Arc<SiteCtxt>) -> ServerResult<dashboard::Re
8282
static ref STABLE_BENCHMARKS: Vec<String> = get_stable_benchmark_names();
8383
}
8484

85-
let query = selector::CompileBenchmarkQuery::default()
85+
let compile_benchmark_query = selector::CompileBenchmarkQuery::default()
86+
.benchmark(selector::Selector::Subset(STABLE_BENCHMARKS.clone()))
87+
.metric(selector::Selector::One(Metric::WallTime));
88+
let runtime_benchmark_query = selector::RuntimeBenchmarkQuery::default()
8689
.benchmark(selector::Selector::Subset(STABLE_BENCHMARKS.clone()))
8790
.metric(selector::Selector::One(Metric::WallTime));
8891

8992
let summary_scenarios = ctxt.summary_scenarios();
93+
let aids = &artifact_ids;
9094
let by_profile = ByProfile::new::<String, _, _>(|profile| {
9195
let summary_scenarios = &summary_scenarios;
9296
let ctxt = &ctxt;
93-
let query = &query;
94-
let aids = &artifact_ids;
97+
let compile_benchmark_query = &compile_benchmark_query;
9598
async move {
9699
let mut cases = dashboard::Cases::default();
97100
for scenario in summary_scenarios.iter() {
98101
let responses = ctxt
99102
.statistic_series(
100-
query
103+
compile_benchmark_query
101104
.clone()
102105
.profile(selector::Selector::One(profile))
103106
.scenario(selector::Selector::One(*scenario)),
@@ -130,6 +133,19 @@ pub async fn handle_dashboard(ctxt: Arc<SiteCtxt>) -> ServerResult<dashboard::Re
130133
.await
131134
.unwrap();
132135

136+
let runtime_benchmark_query = &runtime_benchmark_query;
137+
let responses = ctxt
138+
.statistic_series(runtime_benchmark_query.clone(), aids.clone())
139+
.await?;
140+
let points = db::average(
141+
responses
142+
.into_iter()
143+
.map(|sr| sr.interpolate().series)
144+
.collect::<Vec<_>>(),
145+
)
146+
.map(|((_id, point), _interpolated)| (point.expect("interpolated") * 100.0).round() / 100.0)
147+
.collect::<Vec<_>>();
148+
133149
Ok(dashboard::Response {
134150
versions: artifact_ids
135151
.iter()
@@ -142,6 +158,7 @@ pub async fn handle_dashboard(ctxt: Arc<SiteCtxt>) -> ServerResult<dashboard::Re
142158
debug: by_profile.debug,
143159
opt: by_profile.opt,
144160
doc: by_profile.doc,
161+
runtime: points,
145162
})
146163
}
147164

0 commit comments

Comments
 (0)