1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
//! Benchmark function registry
//!
//! This module provides runtime discovery of benchmark functions that have been
//! marked with the `#[benchmark]` attribute macro.
use crate;
/// A registered benchmark function
///
/// This struct is submitted to the global registry by the `#[benchmark]` macro.
/// It contains the function's name and a runner that executes the benchmark.
// Register the BenchFunction type with inventory
collect!;
/// Discovers all registered benchmark functions
///
/// Returns a vector of references to all functions that have been marked with
/// the `#[benchmark]` attribute in the current binary.
///
/// # Example
///
/// ```no_run
/// use mobench_sdk::registry::discover_benchmarks;
///
/// fn main() {
/// let benchmarks = discover_benchmarks();
/// for bench in benchmarks {
/// println!("Found benchmark: {}", bench.name);
/// }
/// }
/// ```
/// Finds a benchmark function by name
///
/// Searches the registry for a function with the given name. Supports both
/// short names (e.g., "fibonacci") and fully-qualified names
/// (e.g., "my_crate::fibonacci").
///
/// # Arguments
///
/// * `name` - The name of the benchmark to find
///
/// # Returns
///
/// * `Some(&BenchFunction)` if found
/// * `None` if no matching benchmark exists
///
/// # Example
///
/// ```no_run
/// use mobench_sdk::registry::find_benchmark;
///
/// fn main() {
/// if let Some(bench) = find_benchmark("fibonacci") {
/// println!("Found benchmark: {}", bench.name);
/// } else {
/// eprintln!("Benchmark not found");
/// }
/// }
/// ```
/// Lists all registered benchmark names
///
/// Returns a sorted vector of all benchmark function names in the registry.
///
/// # Example
///
/// ```no_run
/// use mobench_sdk::registry::list_benchmark_names;
///
/// fn main() {
/// let names = list_benchmark_names();
/// println!("Available benchmarks:");
/// for name in names {
/// println!(" - {}", name);
/// }
/// }
/// ```