zprofile provides statistical (sampling) CPU and wall-clock profilers for Python applications. Derived from the `google-cloud-profiler`, it allows users to collect profiling data with minimal overhead, making it suitable for production environments. The library outputs data in the `pprof` format, which can then be visualized using the external `go tool pprof`. The current version is 1.0.13, last released in August 2023, indicating a maintenance-oriented release cadence.
pip install zprofileVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use the `CPUProfiler` to collect CPU usage statistics over a 10-second period for a simulated busy-wait function. The collected profile data is saved to a file named `profile.pprof`, which can then be visualized using the `go tool pprof` utility.
Install the Go SDK from golang.org/doc/install and ensure `go tool pprof` is in your system's PATH. Then run `go tool pprof -http=:8080 profile.pprof` in your terminal to view the interactive flame graph.
For general system profiling, `zprofile` is effective. If precise, per-line execution counts for extremely fast operations are needed, consider `cProfile` (built-in Python) or other deterministic profilers, understanding their potentially higher overhead. Ensure your profiled code runs long enough to generate meaningful samples (e.g., at least a few seconds).
No dependency data recorded yet.