Skip to content

Commit ad20446

Browse files
authored
Merge pull request #1947 from s7tya/fix/remove-interpolated-points-and-fix-graph-unit
remove interpolated points of dashboard's runtime bench and fix graph unit
2 parents 8856737 + 79fa3b3 commit ad20446

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

site/frontend/src/pages/dashboard.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,13 @@ function render(
8080
}
8181

8282
function renderRuntime(element: string, data: [number], versions: [string]) {
83+
// Remove null and convert nanoseconds to miliseconds
84+
// The null values, which indicate that the runtime data is missing, are only present at the beginning of the array.
85+
const formattedData = data
86+
.filter((data) => data != null)
87+
.map((data) => data / 1_000_000);
88+
const nullCount = data.length - formattedData.length;
89+
8390
Highcharts.chart({
8491
chart: {
8592
renderTo: element,
@@ -92,19 +99,19 @@ function renderRuntime(element: string, data: [number], versions: [string]) {
9299
text: `Average time for a runtime benchmark`,
93100
},
94101
yAxis: {
95-
title: {text: "Seconds"},
102+
title: {text: "Miliseconds"},
96103
min: 0,
97104
},
98105
xAxis: {
99-
categories: versions,
106+
categories: versions.slice(nullCount),
100107
title: {text: "Version"},
101108
},
102109
series: [
103110
{
104111
showInLegend: false,
105112
type: "line",
106113
animation: false,
107-
data,
114+
data: formattedData,
108115
},
109116
],
110117
});

site/src/api.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ pub mod dashboard {
7575
pub debug: Cases,
7676
pub opt: Cases,
7777
pub doc: Cases,
78-
pub runtime: Vec<f64>,
78+
pub runtime: Vec<Option<f64>>,
7979
}
8080
}
8181

site/src/request_handlers/dashboard.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,26 @@ pub async fn handle_dashboard(ctxt: Arc<SiteCtxt>) -> ServerResult<dashboard::Re
137137
let responses = ctxt
138138
.statistic_series(runtime_benchmark_query.clone(), aids.clone())
139139
.await?;
140+
141+
// The flag is used to ignore only the initial values where the runtime benchmark was not implemented.
142+
let mut ignore_runtime_benchmark = true;
140143
let points = db::average(
141144
responses
142145
.into_iter()
143146
.map(|sr| sr.interpolate().series)
144147
.collect::<Vec<_>>(),
145148
)
146-
.map(|((_id, point), _interpolated)| (point.expect("interpolated") * 100.0).round() / 100.0)
149+
.map(|((_id, point), interpolated)| {
150+
if !interpolated.as_bool() {
151+
ignore_runtime_benchmark = false;
152+
}
153+
154+
if ignore_runtime_benchmark && interpolated.as_bool() {
155+
None
156+
} else {
157+
Some((point.expect("interpolated") * 100.0).round() / 100.0)
158+
}
159+
})
147160
.collect::<Vec<_>>();
148161

149162
Ok(dashboard::Response {

0 commit comments

Comments
 (0)