File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed 
crates/divan_compat/divan_fork/src Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -314,7 +314,15 @@ impl Divan {
314314                        // WARNING: Keep in sync with `codspeed-divan-compat::uri::generate` 
315315                        // Not worth doing the work of actually using the same code since this fork 
316316                        // is temporary 
317-                         let  name = bench_entry. display_name ( ) . to_string ( ) ; 
317+ 
318+                         let  mut  codspeed_bench_name = bench_entry. display_name ( ) . to_string ( ) ; 
319+                         if  bench_display_name != codspeed_bench_name { 
320+                             // When running with args, the `bench_display_name` closure argument is the arg name and not the entry name. 
321+                             // Append the arg name to the entry name we exctrated from metadata. 
322+                             codspeed_bench_name
323+                                 . push_str ( format ! ( "[{bench_display_name}]" ) . as_str ( ) ) ; 
324+                         } 
325+ 
318326                        let  file = bench_entry. meta ( ) . location . file ; 
319327                        let  mut  module_path = bench_entry
320328                            . meta ( ) 
@@ -325,7 +333,7 @@ impl Divan {
325333                        if  !module_path. is_empty ( )  { 
326334                            module_path. push_str ( "::" ) ; 
327335                        } 
328-                         let  uri = format ! ( "{file}::{module_path}{name }" ) ; 
336+                         let  uri = format ! ( "{file}::{module_path}{codspeed_bench_name }" ) ; 
329337                        let  iter_per_round = bench_context. samples . sample_size ; 
330338                        let  times_ns:  Vec < _ >  = bench_context
331339                            . samples 
@@ -336,7 +344,7 @@ impl Divan {
336344                        let  max_time_ns = options. max_time . map ( |t| t. as_nanos ( ) ) ; 
337345                        :: codspeed:: walltime:: collect_raw_walltime_results ( 
338346                            "divan" , 
339-                             name , 
347+                             codspeed_bench_name , 
340348                            uri, 
341349                            iter_per_round, 
342350                            max_time_ns, 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments