pub struct SamplingProfiler {
pub samples: Vec<ProfileSample>,
pub enabled: bool,
pub interval_ns: u64,
pub current_stack: Vec<String>,
}Expand description
A sampling-based profiler.
Fields§
§samples: Vec<ProfileSample>Collected samples.
enabled: boolWhether sampling is enabled.
interval_ns: u64Configured sampling interval in nanoseconds.
current_stack: Vec<String>Current simulated call stack.
Implementations§
Source§impl SamplingProfiler
impl SamplingProfiler
Sourcepub fn take_sample(&mut self, thread_id: u64)
pub fn take_sample(&mut self, thread_id: u64)
Take a sample of the current call stack.
Sourcepub fn flat_profile(&self) -> Vec<(String, usize)>
pub fn flat_profile(&self) -> Vec<(String, usize)>
Compute the flat profile: (function_name, hit_count) sorted by count.
Sourcepub fn cumulative_profile(&self) -> Vec<(String, usize)>
pub fn cumulative_profile(&self) -> Vec<(String, usize)>
Compute the cumulative profile: each function gets credit for every sample it appears in (at any depth).
Sourcepub fn sample_count(&self) -> usize
pub fn sample_count(&self) -> usize
Total number of samples collected.
Sourcepub fn avg_stack_depth(&self) -> f64
pub fn avg_stack_depth(&self) -> f64
Average call stack depth across all samples.
Auto Trait Implementations§
impl Freeze for SamplingProfiler
impl RefUnwindSafe for SamplingProfiler
impl Send for SamplingProfiler
impl Sync for SamplingProfiler
impl Unpin for SamplingProfiler
impl UnsafeUnpin for SamplingProfiler
impl UnwindSafe for SamplingProfiler
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