Skip to main content

Flamegraph generator for python’s cProfile stats.

Flamegraphs allow to visualize relations between functions in a very compact and understandable manner.

Flameprof solves main problems of built-in cProfile reporting and can replace gprof2dot because later outputs very huge graphs with a lot of noise.

Flameprof works with profile stat files obtained by Profile.dump_stats() call or via direct script profiling:

python -m cProfile -o myscript.prof myscript.py

Install

Via pip:

pip install flameprof

Or you can invoke flameprof.py directly:

python flameprof.py input.prof > output.svg

Native svg (–format=svg)

Native svg features:

  • compact function names with full names in a tooltip

  • precise timings (cumulative and total)

  • call counts (in a tooltip on hover)

  • green bars show stack frames where flameprof starts to guess timing ratios

  • inverted flamegraph to show total time of all calls

Graph width, row height, font size and threshold can be set via appropriate cli options.

flameprof requests.prof > requests.svg
Requests profile

Inverted flamegraph:

Requests profile

(Images are clickable)

Svg generated with flamegraph.pl (–format=log)

Also flameprof can output trace log suitable as input for flamegraph.pl.

You can treat “samples” as microseconds by default (see --log-mult option).

flameprof --format=log requests.prof | flamegraph > requests-flamegraph.svg
Requests profile with flamegraph.pl

(Image is clickable)

Release files for flameprof 0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flameprof 0.4
File Size Uploaded
flameprof-0.4.tar.gz 7.9 kB Details

Release files / flameprof-0.4.tar.gz

Download URL flameprof-0.4.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
dbc86d4190cbbba624f1e0a40f44d9db96138e27534d83c8ef42d420857875a3
BLAKE2b-256 checksum
How to use checksums
c0e7114f6710d31854b694598f577f9eac49d7f38b7fb8a55e86e2d3f848fd1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/2.7

Release history Release notifications | RSS feed

This release

0.4 This release

1 release file

0.3

1 release file

0.2.1

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page