| Crates.io | scuffle-pprof |
| lib.rs | scuffle-pprof |
| version | 0.2.0 |
| created_at | 2024-11-28 16:57:07.728416+00 |
| updated_at | 2025-06-11 12:40:36.019683+00 |
| description | Helper crate for adding pprof support to your application. |
| homepage | |
| repository | https://github.com/scufflecloud/scuffle |
| max_upload_size | |
| id | 1464785 |
| size | 42,469 |
[!WARNING]
This crate is under active development and may not be stable.
A crate designed to provide a more ergonomic interface to the pprof crate.
Only supports Unix-like systems. This crate will be empty on Windows.
See the changelog for a full release history.
docs — Enables changelog and documentation of feature flags// Create a new CPU profiler with a sampling frequency of 1000 Hz and an empty ignore list.
let cpu = scuffle_pprof::Cpu::new::<String>(1000, &[]);
// Capture a pprof profile for 10 seconds.
// This call is blocking. It is recommended to run it in a separate thread.
let capture = cpu.capture(std::time::Duration::from_secs(10)).unwrap();
// Write the profile to a file.
std::fs::write("capture.pprof", capture).unwrap();
The resulting profile can be analyzed using the pprof tool.
For example, to generate a flamegraph:
pprof -svg capture.pprof
This project is licensed under the MIT or Apache-2.0 license. You can choose between one of them if you use this work.
SPDX-License-Identifier: MIT OR Apache-2.0