Struct cpuprofiler::Profiler [] [src]

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]

Returns the profiler state

Examples

use cpuprofiler::PROFILER;

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

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.

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]

Formats the value using the given formatter.