Skip to main content

debug_benchmarks

Macro debug_benchmarks 

Source
macro_rules! debug_benchmarks {
    () => { ... };
}
Available on crate feature full only.
Expand description

Generates a debug function that prints all discovered benchmarks.

This macro is useful for debugging benchmark registration issues. It creates a function _debug_print_benchmarks() that you can call to see which benchmarks have been registered via #[benchmark].

§Example

use mobench_sdk::{benchmark, debug_benchmarks};

#[benchmark]
fn my_benchmark() {
    std::hint::black_box(42);
}

// Generate the debug function
debug_benchmarks!();

fn main() {
    // Print all registered benchmarks
    _debug_print_benchmarks();
    // Output:
    // Discovered benchmarks:
    //   - my_crate::my_benchmark
}

§Troubleshooting

If no benchmarks are printed:

  1. Ensure functions are annotated with #[benchmark]
  2. Ensure functions are pub (public visibility)
  3. Ensure the crate with benchmarks is linked into the binary
  4. Check that inventory crate is in your dependencies