[][src]Struct cpuprofiler_static::Profiler

pub struct Profiler { /* fields omitted */ }

The Profiler

The Profiler gives access to the cpuprofiler library. By storing the state of the profiler and limiting access we make the FFI safer.

Methods

impl Profiler[src]

pub fn state(&self) -> ProfilerState[src]

Returns the profiler state

Examples

use cpuprofiler::PROFILER;

println!("{}", PROFILER.lock().unwrap().state());

pub fn start<T>(&mut self, fname: T) -> Result<(), Error> where
    T: Into<Vec<u8>>, 
[src]

Start the profiler

Will begin sampling once this function has been called and will not stop until the stop function has been called.

This function takes as an argument a filename. The filename must be both valid Utf8 and a valid CString.

Failures

  • The profiler is currently Active.
  • fname is not a valid CString.
  • fname is not valid Utf8.
  • fname is not a file.
  • The user does not have write access to the file.
  • An internal failure from the cpuprofiler library.

pub fn stop(&mut self) -> Result<(), Error>[src]

Stop the profiler.

This will stop the profiler if it Active and return an error otherwise.

Failures

  • The profiler is NotActive.

Trait Implementations

impl Debug for Profiler[src]

Auto Trait Implementations

Blanket Implementations

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

impl<T> From<T> for 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.

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

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]