#[cfg(feature = "macros")]
pub use timetrace_macros::{profile_function, profile_session};
pub mod profiler;
pub mod trace_event;
#[macro_export]
macro_rules! profile_begin_session {
($name:expr, $filepath:expr) => {
$crate::profiler::Profiler::get()
.lock()
.begin_session($name, $filepath);
};
}
#[macro_export]
macro_rules! profile_begin_session_limited {
($name:expr, $path:expr, $frames:expr, $ms:expr) => {
$crate::profiler::Profiler::get()
.lock()
.begin_session_limited($name, $path, $frames, $ms);
};
}
#[macro_export]
macro_rules! profile_end_session {
() => {
$crate::profiler::Profiler::get()
.lock()
.end_session()
.unwrap();
};
}
#[macro_export]
macro_rules! profile_scope {
($name:expr) => {
let _timer = $crate::profiler::ProfilerTimer::new($name);
};
}
#[macro_export]
macro_rules! profile_function_scope {
() => {
let _timer = $crate::profiler::ProfilerTimer::new(module_path!());
};
}
#[macro_export]
macro_rules! profile_new_frame {
() => {
$crate::profiler::Profiler::get().lock().next_frame();
};
}
#[macro_export]
macro_rules! profile_update {
($name:expr, $value:expr) => {
profile_new_frame!();
};
}