[][src]Struct persil::Profiler

pub struct Profiler { /* fields omitted */ }

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.