Skip to content

Commit 579860f

Browse files
committed
Document the switch to HW counters
1 parent 66048fe commit 579860f

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -471,19 +471,23 @@ pub mod self_profile {
471471
pub artifact_sizes: Option<Vec<ArtifactSize>>,
472472
}
473473

474+
// Due to backwards compatibility, self profile event timing data is represented as durations,
475+
// however since https://github.com/rust-lang/rustc-perf/pull/1647 it actually represents
476+
// HW counter data (instruction counts).
474477
#[derive(Serialize, Deserialize, Clone, Debug)]
475478
pub struct QueryData {
476479
pub label: QueryLabel,
477-
// Nanoseconds
480+
// Instruction count
478481
pub time: u64,
482+
// Instruction count
479483
pub self_time: u64,
480484
pub percent_total_time: f32,
481485
pub number_of_cache_misses: u32,
482486
pub number_of_cache_hits: u32,
483487
pub invocation_count: u32,
484-
// Nanoseconds
488+
// Instruction count
485489
pub blocked_time: u64,
486-
// Nanoseconds
490+
// Instruction count
487491
pub incremental_load_time: u64,
488492
}
489493

site/src/request_handlers/self_profile.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -541,17 +541,17 @@ pub async fn handle_self_profile(
541541
}
542542
let commits = Arc::new(commits);
543543

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

548548
let mut self_profile = get_or_download_self_profile(
549549
ctxt,
550550
commits.first().unwrap().clone(),
551551
bench_name,
552552
profile,
553553
scenario,
554-
cpu_response.next().unwrap().1,
554+
instructions_response.next().unwrap().1,
555555
)
556556
.await?;
557557
let base_self_profile = match commits.get(1) {
@@ -562,7 +562,7 @@ pub async fn handle_self_profile(
562562
bench_name,
563563
profile,
564564
scenario,
565-
cpu_response.next().unwrap().1,
565+
instructions_response.next().unwrap().1,
566566
)
567567
.await?,
568568
),

site/src/self_profile.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ pub(crate) async fn get_or_download_self_profile(
318318
}
319319

320320
fn get_self_profile_data(
321-
cpu_clock: Option<f64>,
321+
total_instructions: Option<f64>,
322322
profile: &analyzeme::AnalysisResults,
323323
) -> ServerResult<self_profile::SelfProfile> {
324324
let total_self_time: Duration = profile.query_data.iter().map(|qd| qd.self_time).sum();
@@ -345,7 +345,7 @@ fn get_self_profile_data(
345345
time: profile.total_time.as_nanos() as u64,
346346
self_time: total_self_time.as_nanos() as u64,
347347
// TODO: check against wall-time from perf stats
348-
percent_total_time: cpu_clock
348+
percent_total_time: total_instructions
349349
.map(|w| ((total_self_time.as_secs_f64() / w) * 100.0) as f32)
350350
// sentinel "we couldn't compute this time"
351351
.unwrap_or(-100.0),

0 commit comments

Comments
 (0)