Skip to content

Commit 7162f86

Browse files
committed
Document the switch to HW counters
1 parent 0b72313 commit 7162f86

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed

site/frontend/templates/pages/detailed-query.html

+2
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ <h4>Artifact Size</h4>
8080
</tbody>
8181
</table>
8282
<p>'Instructions (%)' is the percentage of instructions executed on this query.</p>
83+
<p><b>Note: self-profile measurements have been <a href="https://github.com/rust-lang/rustc-perf/pull/1647">recently switched</a>
84+
from wall-time to HW counters (instruction count). If comparing with an older artifact, the timings might not be directly comparable.</b></p>
8385
<p>Executions do not include cached executions.</p>
8486
<table>
8587
<thead>

site/src/api.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -333,18 +333,21 @@ pub mod self_profile {
333333
pub artifact_sizes: Option<Vec<ArtifactSize>>,
334334
}
335335

336+
// Due to backwards compatibility, self profile event timing data is represented as durations,
337+
// however since https://github.com/rust-lang/rustc-perf/pull/1647 it actually represents
338+
// HW counter data (instruction counts).
336339
#[derive(Serialize, Deserialize, Clone, Debug)]
337340
pub struct QueryData {
338341
pub label: QueryLabel,
339-
// Nanoseconds
342+
// Instruction count
340343
pub self_time: u64,
341344
pub percent_total_time: f32,
342345
pub number_of_cache_misses: u32,
343346
pub number_of_cache_hits: u32,
344347
pub invocation_count: u32,
345-
// Nanoseconds
348+
// Instruction count
346349
pub blocked_time: u64,
347-
// Nanoseconds
350+
// Instruction count
348351
pub incremental_load_time: u64,
349352
}
350353

site/src/request_handlers/self_profile.rs

+13-9
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ pub async fn handle_self_profile_processed_download(
155155
}
156156

157157
fn get_self_profile_data(
158-
cpu_clock: Option<f64>,
158+
total_instructions: Option<f64>,
159159
profile: &analyzeme::AnalysisResults,
160160
) -> ServerResult<self_profile::SelfProfile> {
161161
let total_time: Duration = profile.query_data.iter().map(|qd| qd.self_time).sum();
@@ -180,7 +180,7 @@ fn get_self_profile_data(
180180
label: "Totals".into(),
181181
self_time: total_time.as_nanos() as u64,
182182
// TODO: check against wall-time from perf stats
183-
percent_total_time: cpu_clock
183+
percent_total_time: total_instructions
184184
.map(|w| ((total_time.as_secs_f64() / w) * 100.0) as f32)
185185
// sentinel "we couldn't compute this time"
186186
.unwrap_or(-100.0),
@@ -602,9 +602,9 @@ pub async fn handle_self_profile(
602602
}
603603
let commits = Arc::new(commits);
604604

605-
let mut cpu_responses = ctxt.statistic_series(query, commits.clone()).await?;
606-
assert_eq!(cpu_responses.len(), 1, "all selectors are exact");
607-
let mut cpu_response = cpu_responses.remove(0).series;
605+
let mut instructions_responses = ctxt.statistic_series(query, commits.clone()).await?;
606+
assert_eq!(instructions_responses.len(), 1, "all selectors are exact");
607+
let mut instructions_response = instructions_responses.remove(0).series;
608608

609609
let mut self_profile_data = Vec::new();
610610
let conn = ctxt.conn().await;
@@ -623,12 +623,16 @@ pub async fn handle_self_profile(
623623
}
624624
}
625625
let profiling_data = self_profile_data.remove(0).perform_analysis();
626-
let mut profile = get_self_profile_data(cpu_response.next().unwrap().1, &profiling_data)
627-
.map_err(|e| format!("{}: {}", body.commit, e))?;
626+
let mut profile =
627+
get_self_profile_data(instructions_response.next().unwrap().1, &profiling_data)
628+
.map_err(|e| format!("{}: {}", body.commit, e))?;
628629
let (base_profile, base_raw_data) = if body.base_commit.is_some() {
629630
let base_profiling_data = self_profile_data.remove(0).perform_analysis();
630-
let profile = get_self_profile_data(cpu_response.next().unwrap().1, &base_profiling_data)
631-
.map_err(|e| format!("{}: {}", body.base_commit.as_ref().unwrap(), e))?;
631+
let profile = get_self_profile_data(
632+
instructions_response.next().unwrap().1,
633+
&base_profiling_data,
634+
)
635+
.map_err(|e| format!("{}: {}", body.base_commit.as_ref().unwrap(), e))?;
632636
(Some(profile), Some(base_profiling_data))
633637
} else {
634638
(None, None)

0 commit comments

Comments
 (0)