Skip to content

Commit 6f1ad7d

Browse files
authored
Merge pull request #1945 from s7tya/feat/add-runtime-chart-to-dashboard
Add runtime chart to dashboard
2 parents a82430e + 4644e24 commit 6f1ad7d

File tree

5 files changed

+91
-21
lines changed

5 files changed

+91
-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 runtime benchmark`,
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: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,38 @@
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. The dashboard also shows the average duration of runtime benchmarks, which measure the performance of
23+
Rust programs
24+
compiled by a given version of the Rust compiler.
1125
</details>
1226

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>
27+
<div class="graphs">
28+
<div id="check-average-times"></div>
29+
<div id="debug-average-times"></div>
30+
<div id="opt-average-times"></div>
31+
<div id="doc-average-times"></div>
32+
<div id="runtime-average-times"></div>
33+
</div>
1734
<div id="as-of"></div>
1835
{% endblock %}
1936
{% block script %}
2037
<script src="scripts/dashboard.js"></script>
21-
{% endblock %}
38+
{% 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,22 @@ 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()
8686
.benchmark(selector::Selector::Subset(STABLE_BENCHMARKS.clone()))
8787
.metric(selector::Selector::One(Metric::WallTime));
8888

8989
let summary_scenarios = ctxt.summary_scenarios();
90+
let aids = &artifact_ids;
9091
let by_profile = ByProfile::new::<String, _, _>(|profile| {
9192
let summary_scenarios = &summary_scenarios;
9293
let ctxt = &ctxt;
93-
let query = &query;
94-
let aids = &artifact_ids;
94+
let compile_benchmark_query = &compile_benchmark_query;
9595
async move {
9696
let mut cases = dashboard::Cases::default();
9797
for scenario in summary_scenarios.iter() {
9898
let responses = ctxt
9999
.statistic_series(
100-
query
100+
compile_benchmark_query
101101
.clone()
102102
.profile(selector::Selector::One(profile))
103103
.scenario(selector::Selector::One(*scenario)),
@@ -130,6 +130,22 @@ pub async fn handle_dashboard(ctxt: Arc<SiteCtxt>) -> ServerResult<dashboard::Re
130130
.await
131131
.unwrap();
132132

133+
let runtime_benchmark_query = selector::RuntimeBenchmarkQuery::default()
134+
.benchmark(selector::Selector::All)
135+
.metric(selector::Selector::One(Metric::WallTime));
136+
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

site/src/selector.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ pub fn range_subset(data: Vec<Commit>, range: RangeInclusive<Bound>) -> Vec<Comm
8686
}
8787
}
8888

89+
#[derive(Debug)]
8990
struct ArtifactIdIter {
9091
ids: Arc<Vec<ArtifactId>>,
9192
idx: usize,
@@ -424,6 +425,7 @@ impl SiteCtxt {
424425
}
425426
}
426427

428+
#[derive(Debug)]
427429
pub struct StatisticSeries {
428430
artifact_ids: ArtifactIdIter,
429431
points: std::vec::IntoIter<Option<f64>>,

0 commit comments

Comments
 (0)