Crate profiler[][src]

Profile a part of the code using CPU Profiler from gperftools or Callgrind. Supports Linux and MacOS.

Requirements

  1. gperftools

    Linux:

    You can follow its INSTALL manual. Roughly the instructions are the following:

    1. Download packages from release
    2. Run ./configure
    3. Run make install

    MacOS:

    Simply brew install gperftools.

Usage

profiler::start("./app.profile");
some_complex_code();
profiler::stop();

Then, compile the code with profiling feature enabled.

By default, a profile called app.profile will be generated by CPU Profiler. You can then analyze the profile using pprof.

If the application is running in Callgrind, a Callgrind profile dump will be generated instead. Notice that you should run Callgrind with command line option --instr-atstart=no, e.g.:

valgrind --tool=callgrind --instr-atstart=no ./my_example

Also see examples/prime.rs.

Modules

profiler_dummy

Functions

start

Start profiling. Always returns false if profiling feature is not enabled.

stop

Stop profiling. Always returns false if profiling feature is not enabled.