@@ -96,7 +96,7 @@ pub async fn handle_triage(
9696 . clone ( )
9797 . summarize_by_category ( & benchmark_map) ;
9898 let mut result = String :: from ( "**Summary**:\n \n " ) ;
99- write_summary_table ( & primary, & secondary, false , & mut result) ;
99+ write_summary_table ( & primary, & secondary, false , true , & mut result) ;
100100 result
101101 }
102102 None => String :: from ( "**ERROR**: no data found for end bound" ) ,
@@ -513,7 +513,7 @@ async fn write_triage_summary(
513513 let link = & compare_link ( start, end) ;
514514 write ! ( & mut result, " [(Comparison Link)]({})\n \n " , link) . unwrap ( ) ;
515515
516- write_summary_table ( & primary, & secondary, false , & mut result) ;
516+ write_summary_table ( & primary, & secondary, false , true , & mut result) ;
517517
518518 result
519519}
@@ -523,17 +523,20 @@ pub fn write_summary_table(
523523 primary : & ArtifactComparisonSummary ,
524524 secondary : & ArtifactComparisonSummary ,
525525 with_footnotes : bool ,
526+ include_metric : bool ,
526527 result : & mut String ,
527528) {
528- let metric = match primary
529- . relevant_comparisons
530- . first ( )
531- . or ( secondary. relevant_comparisons . first ( ) )
532- . map ( |m| m. metric . as_str ( ) )
533- {
534- Some ( m) => m,
535- None => return ,
536- } ;
529+ let metric = include_metric
530+ . then ( || {
531+ primary
532+ . relevant_comparisons
533+ . first ( )
534+ . or ( secondary. relevant_comparisons . first ( ) )
535+ . map ( |m| m. metric . as_str ( ) )
536+ } )
537+ . flatten ( )
538+ // we want at least 10 spaces to accommodate "count[^2]"
539+ . unwrap_or ( " " ) ;
537540
538541 fn render_stat < F : FnOnce ( ) -> Option < f64 > > ( count : usize , calculate : F ) -> String {
539542 let value = if count > 0 { calculate ( ) } else { None } ;
@@ -637,7 +640,7 @@ pub fn write_summary_table(
637640 // This code attempts to space the table cells evenly so that the data is
638641 // easy to read for anyone who is viewing the Markdown source.
639642 let column_labels = [
640- format ! ( "({metric})" , ) ,
643+ format ! ( "({metric})" ) ,
641644 format ! ( "mean{}" , if with_footnotes { "[^1]" } else { "" } ) ,
642645 "max" . to_string ( ) ,
643646 format ! ( "count{}" , if with_footnotes { "[^2]" } else { "" } ) ,
@@ -1581,7 +1584,7 @@ mod tests {
15811584 let secondary = ArtifactComparisonSummary :: summarize ( secondary_comparisons) ;
15821585
15831586 let mut result = String :: new ( ) ;
1584- write_summary_table ( & primary, & secondary, true , & mut result) ;
1587+ write_summary_table ( & primary, & secondary, true , true , & mut result) ;
15851588 let header = "| (instructions:u) | mean[^1] | max | count[^2] |\n |:----------------:|:--------:|:---:|:---------:|\n " ;
15861589 assert_eq ! ( result, format!( "{header}{expected}" ) ) ;
15871590 }
0 commit comments