Skip to content

Commit 428b726

Browse files
feat(divan_fork): put args between brackets in bench URI
1 parent 9e4e9e4 commit 428b726

File tree

1 file changed

+11
-1
lines changed
  • crates/divan_compat/divan_fork/src

1 file changed

+11
-1
lines changed

crates/divan_compat/divan_fork/src/divan.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,13 @@ impl Divan {
315315
// Not worth doing the work of actually using the same code since this fork
316316
// is temporary
317317
let name = bench_entry.display_name().to_string();
318+
// When running with args, `bench_display_name` is the arg name
319+
let arg_name = if bench_display_name == name {
320+
None
321+
} else {
322+
Some(bench_display_name.to_string())
323+
};
324+
318325
let file = bench_entry.meta().location.file;
319326
let mut module_path = bench_entry
320327
.meta()
@@ -325,7 +332,10 @@ impl Divan {
325332
if !module_path.is_empty() {
326333
module_path.push_str("::");
327334
}
328-
let uri = format!("{file}::{module_path}{name}");
335+
let mut uri = format!("{file}::{module_path}{name}");
336+
if let Some(arg_name) = arg_name {
337+
uri.push_str(format!("[{arg_name}]").as_str());
338+
}
329339
let iter_per_round = bench_context.samples.sample_size;
330340
let times_ns: Vec<_> = bench_context
331341
.samples

0 commit comments

Comments
 (0)