[−][src]Struct persil::Profiler
The Profiler
struct is used to trace events.
The events will be stored on disk, if the profiler instance is dropped.
Implementations
impl Profiler
[src]
pub fn from_path(path: impl Into<PathBuf>) -> Result<Self, Box<dyn Error>>
[src]
Creates a new Profiler
with the given path.
The profiling results will be stored at <path>.events
, <path>.strings
, etc.
Errors
The method will fail if the path does not exist or some other error occurrs while initializing the profiler.
pub fn from_name(name: impl AsRef<str>) -> Result<Self, Box<dyn Error>>
[src]
Creates a new Profiler
from a given application name.
The profiling results will be stored at ./trace/<name>-<pid>.events
, etc.
Errors
The method will fail if the path does not exist or some other error occurrs while initializing the profiler.
pub fn enable(&self)
[src]
Enables the Profiler
.
A Profiler
, that is created via from_path
or from_name
,
is disabled by default so you have to enable it first using this method.
pub fn disable(&self)
[src]
Disables the Profiler
.
This method will make the profiler stop recording any new events but will still write all stored results to disk if dropped.
pub fn trace(&self, category: &str, label: &str) -> Guard<'_>
[src]
Starts profiling an event with the given category
and label
.
Auto Trait Implementations
impl RefUnwindSafe for Profiler
impl Send for Profiler
impl Sync for Profiler
impl Unpin for Profiler
impl UnwindSafe for Profiler
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,