@@ -29,6 +29,12 @@ struct Cli {
2929 #[ arg( long, value_delimiter = ',' ) ]
3030 prev_json_paths : Option < Vec < PathBuf > > ,
3131
32+ /// Display names for each metrics file (optional).
33+ /// If provided, must be same length and in same order as `json-paths`.
34+ /// Otherwise, the app program name will be used.
35+ #[ arg( long, value_delimiter = ',' ) ]
36+ names : Option < Vec < String > > ,
37+
3238 /// Path to write the output JSON in BMF format
3339 #[ arg( long) ]
3440 output_json : Option < PathBuf > ,
@@ -55,10 +61,21 @@ fn main() -> Result<()> {
5561 } else {
5662 vec ! [ None ; args. json_paths. len( ) ]
5763 } ;
64+ let names = args. names . unwrap_or_default ( ) ;
65+ let mut names = if names. len ( ) == args. json_paths . len ( ) {
66+ names
67+ } else {
68+ vec ! [ "" . to_string( ) ; args. json_paths. len( ) ]
69+ } ;
5870 let mut aggregated_metrics = Vec :: new ( ) ;
5971 let mut md_paths = Vec :: new ( ) ;
6072 let mut output = BenchmarkOutput :: default ( ) ;
61- for ( metrics_path, prev_metrics_path) in args. json_paths . into_iter ( ) . zip_eq ( prev_json_paths) {
73+ for ( ( metrics_path, prev_metrics_path) , name) in args
74+ . json_paths
75+ . into_iter ( )
76+ . zip_eq ( prev_json_paths)
77+ . zip_eq ( & mut names)
78+ {
6279 let db = MetricDb :: new ( & metrics_path) ?;
6380 let grouped = GroupedMetrics :: new ( & db, "group" ) ?;
6481 let mut aggregated = grouped. aggregate ( ) ;
@@ -71,8 +88,10 @@ fn main() -> Result<()> {
7188 aggregated. set_diff ( prev_aggregated. as_ref ( ) . unwrap ( ) ) ;
7289 }
7390 }
74-
75- output. insert ( & aggregated. name ( ) , aggregated. to_bencher_metrics ( ) ) ;
91+ if name. is_empty ( ) {
92+ * name = aggregated. name ( ) ;
93+ }
94+ output. insert ( name, aggregated. to_bencher_metrics ( ) ) ;
7695 let mut writer = Vec :: new ( ) ;
7796 aggregated. write_markdown ( & mut writer, VM_METRIC_NAMES ) ?;
7897
@@ -95,8 +114,12 @@ fn main() -> Result<()> {
95114 if let Some ( command) = args. command {
96115 match command {
97116 Commands :: Summary ( cmd) => {
98- let summary =
99- GithubSummary :: new ( & aggregated_metrics, & md_paths, & cmd. benchmark_results_link ) ;
117+ let summary = GithubSummary :: new (
118+ & names,
119+ & aggregated_metrics,
120+ & md_paths,
121+ & cmd. benchmark_results_link ,
122+ ) ;
100123 let mut writer = Vec :: new ( ) ;
101124 summary. write_markdown ( & mut writer) ?;
102125 if let Some ( path) = cmd. summary_md_path {
0 commit comments