Metadata-Version: 2.4
Name: flameprof
Version: 0.4
Summary: cProfile flamegraph generator
Home-page: https://github.com/baverman/flameprof/
Author: Anton Bobrov
Author-email: baverman@gmail.com
License: MIT
Platform: any
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: POSIX
Classifier: Operating System :: MacOS
Classifier: Operating System :: Unix
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Internet
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: System :: Distributed Computing
Classifier: Topic :: System :: Systems Administration
Classifier: Topic :: System :: Monitoring
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: home-page
Dynamic: license
Dynamic: platform
Dynamic: summary

Flamegraph generator for python's `cProfile <https://docs.python.org/3/library/profile.html>`_ stats.

`Flamegraphs <http://www.brendangregg.com/flamegraphs.html>`_ 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 <https://github.com/jrfonseca/gprof2dot>`_ because later outputs
very huge graphs with a lot of noise.

``Flameprof`` works with profile stat files obtained by
`Profile.dump_stats() <https://docs.python.org/3/library/profile.html#profile.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

.. image:: https://cdn.rawgit.com/baverman/flameprof/master/img/requests.svg
    :alt: Requests profile
    :width: 100%
    :align: center

Inverted flamegraph:

.. image:: https://cdn.rawgit.com/baverman/flameprof/master/img/httplib.svg
    :alt: Requests profile
    :width: 100%
    :align: center

(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

.. image:: https://cdn.rawgit.com/baverman/flameprof/master/img/requests-flamegraph.svg
    :alt: Requests profile with flamegraph.pl
    :width: 100%
    :align: center

(Image is clickable)
