@@ -19,11 +19,6 @@ use super::UnitTime;
1919enum AggregatedSections {
2020 /// We know the names and durations of individual compilation sections
2121 Sections ( Vec < ( SectionName , SectionData ) > ) ,
22- /// We only know when .rmeta was generated, so we can distill frontend and codegen time.
23- OnlyMetadataTime {
24- frontend : SectionData ,
25- codegen : SectionData ,
26- } ,
2722 /// We know only the total duration
2823 OnlyTotalDuration ,
2924}
@@ -267,23 +262,13 @@ fn write_unit_table(ctx: &RenderContext<'_>, f: &mut impl Write) -> CargoResult<
267262 let mut units: Vec < & UnitTime > = ctx. unit_times . iter ( ) . collect ( ) ;
268263 units. sort_unstable_by ( |a, b| b. duration . partial_cmp ( & a. duration ) . unwrap ( ) ) ;
269264
270- // We can have a bunch of situations here.
271- // - -Zsection-timings is enabled, and we received some custom sections, in which
272- // case we use them to determine the headers.
273- // - We have at least one rmeta time, so we hard-code Frontend and Codegen headers.
274- // - We only have total durations, so we don't add any additional headers.
275265 let aggregated: Vec < AggregatedSections > = units. iter ( ) . map ( |u| aggregate_sections ( u) ) . collect ( ) ;
276266
277267 let headers: Vec < _ > = if let Some ( sections) = aggregated. iter ( ) . find_map ( |s| match s {
278268 AggregatedSections :: Sections ( sections) => Some ( sections) ,
279269 _ => None ,
280270 } ) {
281271 sections. iter ( ) . map ( |s| s. 0 . clone ( ) ) . collect ( )
282- } else if aggregated
283- . iter ( )
284- . any ( |s| matches ! ( s, AggregatedSections :: OnlyMetadataTime { .. } ) )
285- {
286- vec ! [ SectionName :: Frontend , SectionName :: Codegen ]
287272 } else {
288273 vec ! [ ]
289274 } ;
@@ -331,10 +316,6 @@ fn write_unit_table(ctx: &RenderContext<'_>, f: &mut impl Write) -> CargoResult<
331316 cells. insert ( name, data) ;
332317 }
333318 }
334- AggregatedSections :: OnlyMetadataTime { frontend, codegen } => {
335- cells. insert ( & SectionName :: Frontend , frontend) ;
336- cells. insert ( & SectionName :: Codegen , codegen) ;
337- }
338319 AggregatedSections :: OnlyTotalDuration => { }
339320 } ;
340321 let cells = headers
@@ -418,8 +399,7 @@ fn to_unit_data(unit_times: &[UnitTime]) -> Vec<UnitData> {
418399
419400 Some ( sections)
420401 }
421- AggregatedSections :: OnlyMetadataTime { .. }
422- | AggregatedSections :: OnlyTotalDuration => None ,
402+ AggregatedSections :: OnlyTotalDuration => None ,
423403 } ;
424404
425405 UnitData {
@@ -440,6 +420,13 @@ fn to_unit_data(unit_times: &[UnitTime]) -> Vec<UnitData> {
440420}
441421
442422/// Aggregates section timing information from individual compilation sections.
423+ ///
424+ /// We can have a bunch of situations here.
425+ ///
426+ /// - `-Zsection-timings` is enabled, and we received some custom sections,
427+ /// in which case we use them to determine the headers.
428+ /// - We have at least one rmeta time, so we hard-code Frontend and Codegen headers.
429+ /// - We only have total durations, so we don't add any additional headers.
443430fn aggregate_sections ( unit_time : & UnitTime ) -> AggregatedSections {
444431 let end = unit_time. duration ;
445432
@@ -485,13 +472,16 @@ fn aggregate_sections(unit_time: &UnitTime) -> AggregatedSections {
485472 AggregatedSections :: Sections ( sections)
486473 } else if let Some ( rmeta) = unit_time. rmeta_time {
487474 // We only know when the rmeta time was generated
488- AggregatedSections :: OnlyMetadataTime {
489- frontend : SectionData {
490- start : 0.0 ,
491- end : rmeta,
492- } ,
493- codegen : SectionData { start : rmeta, end } ,
494- }
475+ AggregatedSections :: Sections ( vec ! [
476+ (
477+ SectionName :: Frontend ,
478+ SectionData {
479+ start: 0.0 ,
480+ end: rmeta,
481+ } ,
482+ ) ,
483+ ( SectionName :: Codegen , SectionData { start: rmeta, end } ) ,
484+ ] )
495485 } else {
496486 // We only know the total duration
497487 AggregatedSections :: OnlyTotalDuration
0 commit comments