Skip to content

Commit 3e63c76

Browse files
feat(divan_fork): put args between brackets in bench URI
1 parent f88c9de commit 3e63c76

File tree

1 file changed

+9
-0
lines changed
  • crates/divan_compat/divan_fork/src

1 file changed

+9
-0
lines changed

crates/divan_compat/divan_fork/src/divan.rs

Lines changed: 9 additions & 0 deletions
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()
@@ -326,6 +333,8 @@ impl Divan {
326333
module_path.push_str("::");
327334
}
328335
let uri = format!("{file}::{module_path}{name}");
336+
let uri =
337+
arg_name.map(|arg_name| format!("{uri}[{arg_name}]")).unwrap_or(uri);
329338
let iter_per_round = bench_context.samples.sample_size;
330339
let times_ns: Vec<_> = bench_context
331340
.samples

0 commit comments

Comments
 (0)