#pyroscope #profiler #profiling #pprof


Pyroscope Profiler Agent for continuous profiling of Rust, Python and Ruby applications

9 releases (4 breaking)

0.5.3 Jun 27, 2022
0.5.0 Apr 28, 2022
0.4.0 Mar 30, 2022
0.1.0 Dec 17, 2021

#26 in Profiling

Download history 1829/week @ 2022-12-08 1654/week @ 2022-12-15 1213/week @ 2022-12-22 1395/week @ 2022-12-29 2113/week @ 2023-01-05 2139/week @ 2023-01-12 2011/week @ 2023-01-19 1685/week @ 2023-01-26 1747/week @ 2023-02-02 1621/week @ 2023-02-09 1879/week @ 2023-02-16 2500/week @ 2023-02-23 1875/week @ 2023-03-02 2091/week @ 2023-03-09 3000/week @ 2023-03-16 2463/week @ 2023-03-23

9,759 downloads per month
Used in 4 crates



Rust 2K SLoC // 0.1% comments Python 132 SLoC // 0.1% comments Ruby 75 SLoC // 0.1% comments Shell 43 SLoC // 0.5% comments

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:

pyroscope = "0.5.3"
pyroscope_pprofrs = "0.2"

Include Pyroscope and pprof-rs dependencies:

use pyroscope::PyroscopeAgent;
use pyroscope_pprofrs::{pprof_backend, PprofConfig};

Configure the Pyroscope agent:

 let agent =
     PyroscopeAgent::builder("http://localhost:4040", "myapp-profile")

Profile your code:

 let agent_running = agent.start()?;

 // Computation to profile 

 let agent_ready = agent_running.stop()?;

Pyroscope Server

The Pyroscope Agent send the profiling data to a Pyroscope Server. You need to have a Pyroscope Server running in order to consume and visualize this data. It's not possible, currently, to forward the data to another endpoint.


The Pyroscope Agent and the pprof-rs backend can profile and report data from a multi-threaded program. pprof-rs, however, does not track child-processes and thus profiling is limited to a single process.

Profiling Backends

The Pyroscope Agent doesn't do any profiling. The agent role is to orchasrate a profiling backend, and report the profiling data to the Pyroscope Server. The Agent can support external backends (in fact, all current backends are independent crates) and you can make your own. Backends can also be used seperately. The currently available backends are:


  • Backend: The Pyroscope Agent uses pprof-rs as a backend. As a result, the limitations for pprof-rs also applies.
  • Tagging: As of 0.5.0, the Pyroscope Agent support tagging within threads. Check the Tags and Multi-Thread examples for usage.
  • 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. For a proper shutdown, it's recommended that you run the shutdown function before dropping the Agent.

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.


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

See LICENSE for details.


~256K SLoC