pub struct Profiler { /* private fields */ }Expand description
Integrated profiler for method-level and instruction-level profiling
Implementations§
Source§impl Profiler
impl Profiler
pub fn new() -> Self
pub fn with_max_samples(max_samples: usize) -> Self
pub fn set_enabled(&mut self, enabled: bool)
Sourcepub fn method_enter(
&self,
class_name: &str,
method_name: &str,
) -> Option<Instant>
pub fn method_enter( &self, class_name: &str, method_name: &str, ) -> Option<Instant>
Record method entry - call at start of method execution
Sourcepub fn method_exit(
&self,
class_name: &str,
method_name: &str,
start: Option<Instant>,
)
pub fn method_exit( &self, class_name: &str, method_name: &str, start: Option<Instant>, )
Record method exit - call at end of method execution
Sourcepub fn method_counts(&self) -> HashMap<String, u64>
pub fn method_counts(&self) -> HashMap<String, u64>
Get method invocation counts
Sourcepub fn method_time_ns(&self) -> HashMap<String, u64>
pub fn method_time_ns(&self) -> HashMap<String, u64>
Get method total time (ns)
Sourcepub fn hotspots(&self, top_n: usize) -> Vec<(String, u64, u64)>
pub fn hotspots(&self, top_n: usize) -> Vec<(String, u64, u64)>
Get hotspot methods (sorted by time, descending)
Sourcepub fn export_flame_graph(&self) -> String
pub fn export_flame_graph(&self) -> String
Export in collapsed stack format for flamegraph.pl Format: semicolon-separated stack; whitespace; value
Sourcepub fn write_flame_graph(&self, path: &Path) -> Result<()>
pub fn write_flame_graph(&self, path: &Path) -> Result<()>
Write flame graph data to file
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Profiler
impl RefUnwindSafe for Profiler
impl Send for Profiler
impl Sync for Profiler
impl Unpin for Profiler
impl UnsafeUnpin for Profiler
impl UnwindSafe for Profiler
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more