#[doc(hidden)]
pub use cfg_if::cfg_if;
pub use hotpath_macros::{future_fn, main, measure, measure_all, skip};
pub mod channels;
pub mod futures;
pub mod streams;
#[cfg(feature = "threads")]
pub mod threads;
pub mod functions;
pub use channels::{InstrumentChannel, InstrumentChannelLog};
pub use futures::{InstrumentFuture, InstrumentFutureLog};
pub use streams::{InstrumentStream, InstrumentStreamLog};
pub use functions::guard::{FunctionsGuard, FunctionsGuardBuilder};
pub use functions::{
measure_with_log, measure_with_log_async, FunctionStats, MeasurementGuard,
MeasurementGuardWithLog,
};
cfg_if::cfg_if! {
if #[cfg(feature = "hotpath-alloc")] {
#[doc(hidden)]
pub use tokio::runtime::{Handle, RuntimeFlavor};
#[global_allocator]
static GLOBAL: functions::alloc::allocator::CountingAllocator = functions::alloc::allocator::CountingAllocator {};
}
}
#[macro_export]
macro_rules! measure_block {
($label:expr, $expr:expr) => {{
let _guard = hotpath::functions::MeasurementGuard::new($label, false, false);
$expr
}};
}
#[cfg(test)]
mod tests {
use super::*;
fn is_send_sync<T: Send + Sync>() {}
#[test]
fn test_hotpath_is_send_sync() {
is_send_sync::<FunctionsGuard>();
}
}