Skip to content

Commit 40179eb

Browse files
committed
refactor(timings): round also aggregated sections
1 parent 9a875a8 commit 40179eb

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

src/cargo/core/compiler/timings/report.rs

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,13 @@ fn aggregate_sections(unit_time: &UnitTime) -> AggregatedSections {
412412
// The frontend section is currently implicit in rustc.
413413
// It is assumed to start at compilation start and end when codegen starts,
414414
// So we hard-code it here.
415-
vec![(SectionName::Frontend, SectionData { start: 0.0, end })],
415+
vec![(
416+
SectionName::Frontend,
417+
SectionData {
418+
start: 0.0,
419+
end: round_to_centisecond(end),
420+
},
421+
)],
416422
|mut sections, (name, section)| {
417423
let previous = sections.last_mut().unwrap();
418424
// Setting the end of previous to the start of the current.
@@ -421,8 +427,8 @@ fn aggregate_sections(unit_time: &UnitTime) -> AggregatedSections {
421427
sections.push((
422428
SectionName::Named(name),
423429
SectionData {
424-
start: section.start,
425-
end: section.end.unwrap_or(end),
430+
start: round_to_centisecond(section.start),
431+
end: round_to_centisecond(section.end.unwrap_or(end)),
426432
},
427433
));
428434

@@ -442,8 +448,8 @@ fn aggregate_sections(unit_time: &UnitTime) -> AggregatedSections {
442448
sections.push((
443449
SectionName::Other,
444450
SectionData {
445-
start: section.end,
446-
end,
451+
start: round_to_centisecond(section.end),
452+
end: round_to_centisecond(end),
447453
},
448454
));
449455
}
@@ -456,10 +462,16 @@ fn aggregate_sections(unit_time: &UnitTime) -> AggregatedSections {
456462
SectionName::Frontend,
457463
SectionData {
458464
start: 0.0,
459-
end: rmeta,
465+
end: round_to_centisecond(rmeta),
466+
},
467+
),
468+
(
469+
SectionName::Codegen,
470+
SectionData {
471+
start: round_to_centisecond(rmeta),
472+
end: round_to_centisecond(end),
460473
},
461474
),
462-
(SectionName::Codegen, SectionData { start: rmeta, end }),
463475
])
464476
} else {
465477
// We only know the total duration

0 commit comments

Comments
 (0)