Skip to content

Commit f7a36a5

Browse files
committed
Document the switch to HW counters
1 parent 2964d24 commit f7a36a5

File tree

5 files changed

+49
-35
lines changed

5 files changed

+49
-35
lines changed

site/frontend/src/pages/detailed-query/page.vue

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,18 @@ loadData();
391391
</table>
392392

393393
<p>
394-
'Time (%)' is the percentage of the cpu-clock time spent on this query
395-
(we do not use wall-time as we want to account for parallelism).
394+
'Instructions (%)' is the percentage of instructions executed on this
395+
query (we do not use wall-time as we want to account for parallelism).
396+
</p>
397+
<p>
398+
<b
399+
>Note: self-profile measurements have been
400+
<a href="https://github.com/rust-lang/rustc-perf/pull/1984"
401+
>recently switched</a
402+
>
403+
from wall-time to HW counters (instruction count). If comparing with
404+
an older artifact, the timings might not be directly comparable.</b
405+
>
396406
</p>
397407
<p>Executions do not include cached executions.</p>
398408

@@ -408,21 +418,21 @@ loadData();
408418
<a
409419
href="#"
410420
@click.prevent="changeSortParameters('timePercent', 'desc')"
411-
>Time (%)</a
421+
>Instructions (%)</a
412422
>
413423
</th>
414424
<th :class="getHeaderClass('timeSeconds')">
415425
<a
416426
href="#"
417427
@click.prevent="changeSortParameters('timeSeconds', 'desc')"
418-
>Time (s)</a
428+
>Instructions</a
419429
>
420430
</th>
421431
<th v-if="showDelta" :class="getHeaderClass('timeDelta')">
422432
<a
423433
href="#"
424434
@click.prevent="changeSortParameters('timeDelta', 'desc')"
425-
>Time delta</a
435+
>Instructions delta</a
426436
>
427437
</th>
428438
<th :class="getHeaderClass('executions')">
@@ -442,14 +452,14 @@ loadData();
442452
<th
443453
v-if="showIncr"
444454
:class="getHeaderClass('incrementalLoading')"
445-
title="Incremental loading time"
455+
title="Incremental loading instructions"
446456
>
447457
<a
448458
href="#"
449459
@click.prevent="
450460
changeSortParameters('incrementalLoading', 'desc')
451461
"
452-
>Incremental loading (s)</a
462+
>Incremental loading (icounts)</a
453463
>
454464
</th>
455465
<th

site/frontend/src/pages/detailed-query/utils.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ export interface SelfProfileResponse {
3737
base_profile_delta?: ProfileData;
3838
}
3939

40-
export function toSeconds(time: number): number {
41-
return time / 1000000000;
40+
export function normalizeValue(icounts: number): number {
41+
return icounts;
4242
}
4343

4444
export function createDelta(
@@ -259,24 +259,24 @@ export function createTableData(
259259
formatted: totals.percent_total_time.toFixed(2) + "%*",
260260
title: "% of cpu-time stat",
261261
},
262-
timeSeconds: toSeconds(totals.self_time),
262+
timeSeconds: normalizeValue(totals.self_time),
263263
timeDelta: totalsDelta
264264
? createDelta(
265-
toSeconds(totals.self_time),
266-
toSeconds(totalsDelta.self_time),
267-
false
265+
normalizeValue(totals.self_time),
266+
normalizeValue(totalsDelta.self_time),
267+
true
268268
)
269269
: null,
270270
executions: totals.invocation_count,
271271
executionsDelta: totalsDelta
272272
? createDelta(totals.invocation_count, totalsDelta.invocation_count, true)
273273
: null,
274-
incrementalLoading: toSeconds(totals.incremental_load_time),
274+
incrementalLoading: normalizeValue(totals.incremental_load_time),
275275
incrementalLoadingDelta: totalsDelta
276276
? createDelta(
277-
toSeconds(totals.incremental_load_time),
278-
toSeconds(totalsDelta.incremental_load_time),
279-
false
277+
normalizeValue(totals.incremental_load_time),
278+
normalizeValue(totalsDelta.incremental_load_time),
279+
true
280280
)
281281
: null,
282282
});
@@ -299,24 +299,24 @@ export function createTableData(
299299
formatted: query.percent_total_time.toFixed(2) + "%",
300300
title: "",
301301
},
302-
timeSeconds: toSeconds(query.self_time),
302+
timeSeconds: normalizeValue(query.self_time),
303303
timeDelta: queryDelta
304304
? createDelta(
305-
toSeconds(query.self_time),
306-
toSeconds(queryDelta.self_time),
307-
false
305+
normalizeValue(query.self_time),
306+
normalizeValue(queryDelta.self_time),
307+
true
308308
)
309309
: null,
310310
executions: query.invocation_count,
311311
executionsDelta: queryDelta
312312
? createDelta(query.invocation_count, queryDelta.invocation_count, true)
313313
: null,
314-
incrementalLoading: toSeconds(query.incremental_load_time),
314+
incrementalLoading: normalizeValue(query.incremental_load_time),
315315
incrementalLoadingDelta: queryDelta
316316
? createDelta(
317-
toSeconds(query.incremental_load_time),
318-
toSeconds(queryDelta.incremental_load_time),
319-
false
317+
normalizeValue(query.incremental_load_time),
318+
normalizeValue(queryDelta.incremental_load_time),
319+
true
320320
)
321321
: null,
322322
});

site/src/api.rs

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

473+
// Due to backwards compatibility, self profile event timing data is represented as durations,
474+
// however since https://github.com/rust-lang/rustc-perf/pull/1647 it actually represents
475+
// HW counter data (instruction counts).
473476
#[derive(Serialize, Deserialize, Clone, Debug)]
474477
pub struct QueryData {
475478
pub label: QueryLabel,
476-
// Nanoseconds
479+
// Instruction count
477480
pub time: u64,
481+
// Instruction count
478482
pub self_time: u64,
479483
pub percent_total_time: f32,
480484
pub number_of_cache_misses: u32,
481485
pub number_of_cache_hits: u32,
482486
pub invocation_count: u32,
483-
// Nanoseconds
487+
// Instruction count
484488
pub blocked_time: u64,
485-
// Nanoseconds
489+
// Instruction count
486490
pub incremental_load_time: u64,
487491
}
488492

site/src/request_handlers/self_profile.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -475,17 +475,17 @@ pub async fn handle_self_profile(
475475
}
476476
let commits = Arc::new(commits);
477477

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

482482
let mut self_profile = get_or_download_self_profile(
483483
ctxt,
484484
commits.first().unwrap().clone(),
485485
bench_name,
486486
profile,
487487
scenario,
488-
cpu_response.next().unwrap().1,
488+
instructions_response.next().unwrap().1,
489489
)
490490
.await?;
491491
let base_self_profile = match commits.get(1) {
@@ -496,7 +496,7 @@ pub async fn handle_self_profile(
496496
bench_name,
497497
profile,
498498
scenario,
499-
cpu_response.next().unwrap().1,
499+
instructions_response.next().unwrap().1,
500500
)
501501
.await?,
502502
),

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)