pub struct Profiler<C: Category = DefaultCategory> { /* private fields */ }
Expand description
Main profiling interface with customizable categories
This struct provides a unified API for profiling that works in both stub and full modes. In stub mode, all methods are no-ops that compile away. In full mode, complete profiling functionality is provided.
§Examples
use quantum_pulse::Profiler;
// This code works identically in both modes
let result = Profiler::time("operation", || {
perform_operation()
});
Implementations§
Source§impl<C: Category> Profiler<C>
impl<C: Category> Profiler<C>
pub fn time<T, F>(_operation: &str, f: F) -> Twhere
F: FnOnce() -> T,
pub fn time_with_category<T, F>(_operation: &str, _category: C, f: F) -> Twhere
F: FnOnce() -> T,
pub async fn time_async<T, F, Fut>(_operation: &str, f: F) -> T
pub async fn time_async_with_category<T, F, Fut>( _operation: &str, _category: C, f: F, ) -> T
Sourcepub fn report() -> ProfileReport<C>
pub fn report() -> ProfileReport<C>
Get a comprehensive profiling report
Sourcepub fn report_with_config(config: ReportConfig) -> ProfileReport<C>
pub fn report_with_config(config: ReportConfig) -> ProfileReport<C>
Get a report with custom configuration
Sourcepub fn reset_operation(operation: &str)
pub fn reset_operation(operation: &str)
Reset metrics for a specific operation
Sourcepub fn record_with_category(operation: &str, category: C, value_micros: u64)
pub fn record_with_category(operation: &str, category: C, value_micros: u64)
Record a metric with a specific category
Sourcepub fn total_operations() -> u64
pub fn total_operations() -> u64
Get total number of operations recorded
Sourcepub fn get_stats(operation: &str) -> Option<OperationStats>
pub fn get_stats(operation: &str) -> Option<OperationStats>
Get statistics for a specific operation
Sourcepub fn get_all_stats() -> HashMap<String, OperationStats>
pub fn get_all_stats() -> HashMap<String, OperationStats>
Get all statistics
Trait Implementations§
Auto Trait Implementations§
impl<C> Freeze for Profiler<C>
impl<C> RefUnwindSafe for Profiler<C>where
C: RefUnwindSafe,
impl<C> Send for Profiler<C>
impl<C> Sync for Profiler<C>
impl<C> Unpin for Profiler<C>where
C: Unpin,
impl<C> UnwindSafe for Profiler<C>where
C: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more