Skip to content

Commit c198b6f

Browse files
Display wall-time stat comparison
1 parent f4fc91e commit c198b6f

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

site/src/server.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,11 +633,20 @@ fn get_self_profile_data(
633633
.as_ref()
634634
.ok_or(format!("No self profile results for this commit"))?
635635
.clone();
636+
let total_time = profile.query_data.iter().map(|qd| qd.self_time).sum();
636637
let totals = self_profile::QueryData {
637638
label: String::from("Totals"),
638-
self_time: profile.query_data.iter().map(|qd| qd.self_time).sum(),
639+
self_time: total_time,
639640
// TODO: check against wall-time from perf stats
640-
percent_total_time: 100.0,
641+
percent_total_time: run
642+
.stats
643+
.get(StatId::CpuClock)
644+
.map(|w| {
645+
// this converts the total_time (a Duration) to the milliseconds in cpu-clock
646+
(((total_time.as_nanos() as f64 / 1000000.0) / w) * 100.0) as f32
647+
})
648+
// sentinel "we couldn't compute this time"
649+
.unwrap_or(-100.0),
641650
number_of_cache_misses: profile
642651
.query_data
643652
.iter()

site/static/detailed-query.html

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
<a href="dashboard.html">dashboard</a>, <a href="status.html">status</a>.</div>
4343
<div id="content">
4444
<h3 id="title"></h3>
45+
<p>Totals row '%total time' is as a comparison to the 'cpu-clock' stat (we do not use
46+
wall-time as we want to account for parallelism).</p>
4547
<table>
4648
<thead>
4749
<tr id="table-header">
@@ -166,7 +168,15 @@ <h3 id="title"></h3>
166168
}
167169
td(row, cur.label);
168170
td(row, to_seconds(cur.self_time).toFixed(3));
169-
td(row, cur.percent_total_time.toFixed(2));
171+
if (cur.percent_total_time < 0) {
172+
td(row, "-").setAttribute("title", "No wall-time stat collected for this run");
173+
} else {
174+
let t = td(row, cur.percent_total_time.toFixed(2) + "%");
175+
if (idx == 0) {
176+
t.innerText += "*";
177+
t.setAttribute("title", "% of wall-time stat");
178+
}
179+
}
170180
if (prev) {
171181
td(row, fmt_delta(to_seconds(prev.self_time), to_seconds(cur.self_time)), true);
172182
} else {

0 commit comments

Comments
 (0)