pyroscope 0.4.0

Pyroscope Profiler
Documentation

Pyroscope Profiler

Pyroscope Profiler for Rust. Profile your Rust applications.

license tests build Crate


You may be looking for:

Table of Contents

Quick Start

Add this to your Cargo.toml:

[dependencies]
pyroscope = "0.4.0"
pyroscope-pprofrs = "0.1"

Configure and create the backend (pprof-rs)

let pprof_config = PprofConfig::new().sample_rate(100);
let pprof_backend = Pprof::new(pprof_config);

Configure the Pyroscope agent:

 let mut agent =
     PyroscopeAgent::builder("http://localhost:4040", "myapp-profile")
     .backend(pprof_backend)
     .build()?;

Profile your code:

 agent.start();
 // Profiled computation
 agent.stop();
 
 // Non-profiled computation

Limitations

  • Backend: The Pyroscope Agent uses pprof-rs as a backend. As a result, the limitations for pprof-rs also applies.
  • Tagging: Adding or removing tags is not possible within threads. In general, the Pyroscope Agent is not Sync; and as a result a reference cannot be shared between threads. A multi-threaded program could be profiled but the agent is not thread-aware and a particular thread cannot be tagged.
  • Timer: epoll (for Linux) and kqueue (for macOS) are required for a more precise timer.
  • Shutdown: The Pyroscope Agent might take some time (usually less than 10 seconds) to shutdown properly and drop its threads.

Getting help

You can read the Docs or check the examples for detailed usage of the library. You can also join the Slack channel if you have questions.

License

Pyroscope is distributed under the Apache License (Version 2.0).

See LICENSE for details.