Skip to content

Commit 56ae65f

Browse files
feat: use the same uri scheme for walltime and intrumented
1 parent ff6f4b3 commit 56ae65f

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

crates/divan_compat/divan_fork/src/divan.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,9 @@ impl Divan {
311311
if should_compute_stats {
312312
let stats = bench_context.compute_stats();
313313
{
314+
// WARNING: Keep in sync with `codspeed-divan-compat::uri::generate`
315+
// Not worth doing the work of actually using the same code since this fork
316+
// is temporary
314317
let name = bench_entry.display_name().to_string();
315318
let file = bench_entry.meta().location.file;
316319
let mut module_path = bench_entry
@@ -588,9 +591,7 @@ impl Divan {
588591
///
589592
/// ```
590593
/// # use divan::Divan;
591-
/// let divan = Divan::default()
592-
/// .skip_regex("(add|sub)")
593-
/// .skip_regex("collections.*default");
594+
/// let divan = Divan::default().skip_regex("(add|sub)").skip_regex("collections.*default");
594595
/// ```
595596
///
596597
/// # Panics
@@ -620,9 +621,8 @@ impl Divan {
620621
///
621622
/// ```
622623
/// # use divan::Divan;
623-
/// let divan = Divan::default()
624-
/// .skip_exact("arithmetic::add")
625-
/// .skip_exact("collections::vec::default");
624+
/// let divan =
625+
/// Divan::default().skip_exact("arithmetic::add").skip_exact("collections::vec::default");
626626
/// ```
627627
#[must_use]
628628
pub fn skip_exact(mut self, filter: impl Into<String>) -> Self {

crates/divan_compat/src/compat/entry.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ pub struct EntryMeta {
5656
pub bench_options: Option<LazyLock<BenchOptions>>,
5757
}
5858

59+
impl EntryMeta {
60+
#[inline]
61+
pub(crate) fn module_path_components<'a>(&self) -> impl Iterator<Item = &'a str> {
62+
self.module_path.split("::")
63+
}
64+
}
65+
5966
/// Where an entry is located.
6067
#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord)]
6168
#[allow(missing_docs)]

crates/divan_compat/src/compat/mod.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pub mod __private {
1111

1212
mod bench;
1313
mod entry;
14+
mod uri;
1415
mod util;
1516

1617
pub use bench::*;
@@ -31,13 +32,7 @@ pub fn main() {
3132

3233
// 4. Scan the tree and execute benchmarks
3334
for entry in bench_entries.iter() {
34-
let entry_uri = format!(
35-
"{}:{}::{}::{}",
36-
entry.meta.location.file,
37-
entry.meta.location.line,
38-
entry.meta.module_path,
39-
entry.meta.display_name,
40-
);
35+
let entry_uri = uri::generate(entry.meta.display_name, &entry.meta);
4136

4237
if let Some(options) = &entry.meta.bench_options.as_ref() {
4338
if let Some(true) = options.ignore {

0 commit comments

Comments
 (0)