1pub use hotpath_macros_meta::{future_fn, main, measure, measure_all, skip};
2
3#[macro_export]
4macro_rules! measure_block {
5 ($label:expr, $expr:expr) => {{
6 $expr
7 }};
8}
9
10#[macro_export]
11macro_rules! dbg {
12 ($val:expr $(,)?) => {
13 match $val {
14 tmp => tmp
15 }
16 };
17 ($($val:expr),+ $(,)?) => {
18 ($($crate::dbg!($val)),+,)
19 };
20}
21
22#[macro_export]
23macro_rules! val {
24 ($key:expr) => {{
25 $crate::ValHandle
26 }};
27}
28
29pub struct ValHandle;
30
31impl ValHandle {
32 #[inline]
33 pub fn set<T: std::fmt::Debug>(&self, _value: &T) {}
34}
35
36pub use crate::shared::IntoF64;
37
38#[macro_export]
39macro_rules! gauge {
40 ($key:expr) => {{
41 $crate::GaugeHandle
42 }};
43}
44
45pub struct GaugeHandle;
46
47impl GaugeHandle {
48 #[inline]
49 pub fn set(&self, _value: impl IntoF64) -> &Self {
50 self
51 }
52
53 #[inline]
54 pub fn inc(&self, _delta: impl IntoF64) -> &Self {
55 self
56 }
57
58 #[inline]
59 pub fn dec(&self, _delta: impl IntoF64) -> &Self {
60 self
61 }
62}
63
64#[macro_export]
65macro_rules! channel {
66 ($expr:expr) => {
67 $expr
68 };
69 ($expr:expr, label = $label:expr) => {
70 $expr
71 };
72 ($expr:expr, capacity = $capacity:expr) => {
73 $expr
74 };
75 ($expr:expr, label = $label:expr, capacity = $capacity:expr) => {
76 $expr
77 };
78 ($expr:expr, capacity = $capacity:expr, label = $label:expr) => {
79 $expr
80 };
81 ($expr:expr, log = true) => {
82 $expr
83 };
84 ($expr:expr, label = $label:expr, log = true) => {
85 $expr
86 };
87 ($expr:expr, log = true, label = $label:expr) => {
88 $expr
89 };
90 ($expr:expr, capacity = $capacity:expr, log = true) => {
91 $expr
92 };
93 ($expr:expr, log = true, capacity = $capacity:expr) => {
94 $expr
95 };
96 ($expr:expr, label = $label:expr, capacity = $capacity:expr, log = true) => {
97 $expr
98 };
99 ($expr:expr, label = $label:expr, log = true, capacity = $capacity:expr) => {
100 $expr
101 };
102 ($expr:expr, capacity = $capacity:expr, label = $label:expr, log = true) => {
103 $expr
104 };
105 ($expr:expr, capacity = $capacity:expr, log = true, label = $label:expr) => {
106 $expr
107 };
108 ($expr:expr, log = true, label = $label:expr, capacity = $capacity:expr) => {
109 $expr
110 };
111 ($expr:expr, log = true, capacity = $capacity:expr, label = $label:expr) => {
112 $expr
113 };
114}
115
116#[macro_export]
117macro_rules! stream {
118 ($expr:expr) => {
119 $expr
120 };
121 ($expr:expr, label = $label:expr) => {
122 $expr
123 };
124 ($expr:expr, log = true) => {
125 $expr
126 };
127 ($expr:expr, label = $label:expr, log = true) => {
128 $expr
129 };
130 ($expr:expr, log = true, label = $label:expr) => {
131 $expr
132 };
133}
134
135#[macro_export]
136macro_rules! tokio_runtime {
137 () => {};
138 ($handle:expr) => {};
139}
140
141#[macro_export]
142macro_rules! future {
143 ($fut:expr) => {
144 $fut
145 };
146 ($fut:expr, label = $label:expr) => {
147 $fut
148 };
149 ($fut:expr, log = true) => {
150 $fut
151 };
152 ($fut:expr, label = $label:expr, log = true) => {
153 $fut
154 };
155 ($fut:expr, log = true, label = $label:expr) => {
156 $fut
157 };
158}
159
160pub use crate::Format;
161pub use crate::Section;
162
163pub struct MeasurementGuard {}
164
165impl MeasurementGuard {
166 pub fn new(_name: &'static str, _wrapper: bool, _unsupported_async: bool) -> Self {
167 Self {}
168 }
169
170 pub fn build(_name: &'static str, _wrapper: bool, _is_async: bool) -> Self {
171 Self {}
172 }
173}
174
175pub struct MeasurementGuardWithLog {}
176
177impl MeasurementGuardWithLog {
178 pub fn new(_name: &'static str, _wrapper: bool, _unsupported_async: bool) -> Self {
179 Self {}
180 }
181
182 pub fn build(_name: &'static str, _wrapper: bool, _is_async: bool) -> Self {
183 Self {}
184 }
185
186 pub fn finish_with_result<T: std::fmt::Debug>(self, _result: &T) {}
187}
188
189#[inline]
190pub fn measure_with_log<T: std::fmt::Debug, F: FnOnce() -> T>(
191 _name: &'static str,
192 _wrapper: bool,
193 _is_async: bool,
194 f: F,
195) -> T {
196 f()
197}
198
199pub async fn measure_with_log_async<T: std::fmt::Debug, F, Fut>(_name: &'static str, f: F) -> T
200where
201 F: FnOnce() -> Fut,
202 Fut: std::future::Future<Output = T>,
203{
204 f().await
205}
206
207pub struct HotpathGuard;
208
209impl Default for HotpathGuard {
210 fn default() -> Self {
211 Self::new()
212 }
213}
214
215impl HotpathGuard {
216 pub fn new() -> Self {
217 Self {}
218 }
219}
220
221pub struct HotpathGuardBuilder {}
222
223impl HotpathGuardBuilder {
224 pub fn new(_caller_name: &'static str) -> Self {
225 Self {}
226 }
227
228 pub fn percentiles(self, _percentiles: &[u8]) -> Self {
229 self
230 }
231
232 pub fn format(self, _format: Format) -> Self {
233 self
234 }
235
236 pub fn with_functions_limit(self, _limit: usize) -> Self {
237 self
238 }
239
240 pub fn with_channels_limit(self, _limit: usize) -> Self {
241 self
242 }
243
244 pub fn with_streams_limit(self, _limit: usize) -> Self {
245 self
246 }
247
248 pub fn with_futures_limit(self, _limit: usize) -> Self {
249 self
250 }
251
252 pub fn with_threads_limit(self, _limit: usize) -> Self {
253 self
254 }
255
256 pub fn output_path(self, _path: impl AsRef<std::path::Path>) -> Self {
257 self
258 }
259
260 pub fn with_sections(self, _sections: Vec<Section>) -> Self {
261 self
262 }
263
264 pub fn before_shutdown(self, _f: impl FnOnce() + Send + 'static) -> Self {
265 self
266 }
267
268 pub fn build(self) -> HotpathGuard {
269 HotpathGuard
270 }
271
272 pub fn build_with_shutdown(self, _duration: std::time::Duration) {}
273}
274
275#[derive(Debug, Clone)]
276pub struct FunctionStats {}
277
278pub mod channels {
279 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
280 pub enum ChannelType {
281 Bounded(usize),
282 Unbounded,
283 Oneshot,
284 }
285}
286
287pub mod streams {}
288
289pub mod threads {}
290
291pub mod futures {}