Description
# About _gprof2dot_ This is a Python script to convert the output from many profilers into a [dot graph](https://www.graphviz.org/doc/info/lang.html). It can: * read output from: * [Linux perf](https://perf.wiki.kernel.org/) * [Valgrind's callgrind tool](https://valgrind.org/docs/manual/cl-manual.html) * [OProfile](https://oprofile.sourceforge.net/) * [Sysprof](http://www.sysprof.com/) * [Xperf](https://learn.microsoft.com/en-us/windows-hardware/test/wpt/) * [VTune](https://www.intel.com/content/www/us/en/developer/tools/oneapi/vtune-profiler.html) * [Very Sleepy](https://www.codersnotes.com/sleepy/) * [Python profilers](https://docs.python.org/3/library/profile.html#profile-stats) * [Java's HPROF](https://docs.oracle.com/javase/7/docs/technotes/samples/hprof.html) * prof, [gprof](https://sourceware.org/binutils/docs/gprof/) * [DTrace](https://en.wikipedia.org/wiki/DTrace) * stackcollapse from [FlameGraph](https://github.com/brendangregg/FlameGraph) * prune nodes and edges below a certain threshold; * use an heuristic to propagate time inside mutually recursive functions; * use color efficiently to draw attention to hot-spots; * work on any platform where Python and Graphviz is available, i.e, virtually anywhere; * compare two graphs with almost identical structures for the analysis of performance metrics such as time or function calls. **If you want an interactive viewer for the graphs generated by _gprof2dot_, check [xdot.py](https://github.com/jrfonseca/xdot.py).** # Status _gprof2dot_ currently fulfills my needs, and I have little or no time for its maintenance. So I'm afraid that any requested features are unlikely to be implemented, and I might be slow processing issue reports or pull requests. [](https://github.com/jrfonseca/gprof2dot/actions/workflows/build.yml) [](https://codecov.io/gh/jrfonseca/gprof2dot) # Example This is the result from the [example data](https://linuxgazette.net/100/misc/vinayak/overall-profile.txt) in the [Linux Gazette article](https://linuxgazette.net/100/vinayak.html) with the default settings:  # Requirements * [Python](https://www.python.org/download/): known to work with version >=3.8; it will most likely _not_ work with earlier releases. * [Graphviz](https://www.graphviz.org/Download.php): tested with version 2.26.3, but should work fine with other versions. ## Windows users * Download and install [Python for Windows](https://www.python.org/download/) * Download and install [Graphviz for Windows](https://www.graphviz.org/Download_windows.php) ## Linux users On Debian/Ubuntu run: apt-get install python3 graphviz On RedHat/Fedora run yum install python3 graphviz # Download * [PyPI](https://pypi.python.org/pypi/gprof2dot/) pip install gprof2dot * [Standalone script](https://raw.githubusercontent.com/jrfonseca/gprof2dot/main/gprof2dot.py) * [Git repository](https://github.com/jrfonseca/gprof2dot) # Documentation ## Usage ``` Usage: gprof2dot.py [options] [file] ... Options: -h, --help show this help message and exit -o FILE, --output=FILE output filename [stdout] -n PERCENTAGE, --node-thres=PERCENTAGE eliminate nodes below this threshold [default: 0.5] -e PERCENTAGE, --edge-thres=PERCENTAGE eliminate edges below this threshold [default: 0.1] -f FORMAT, --format=FORMAT profile format: axe, callgrind, collapse, dtrace, hprof, json, oprofile, perf, prof, pstats, sleepy, sysprof or xperf [default: prof] --total=TOTALMETHOD preferred method of calculating total time: callratios or callstacks (currently affects only perf format) [default: callratios] -c THEME, --colormap=THEME color map: bw, color, gray, pink or print [default: color] -s, --strip strip function parameters, template parameters, and const modifiers from demangled C++ function names --color-nodes-by-selftime color nodes by self time, rather than by total time (sum of self and descendants) -w, --wrap wrap function names --show-samples show function samples --node-label=MEASURE measurements to on show the node (can be specified multiple times): self-time, self-time-percentage, total-time or total-time-percentage [default: total- time-percentage, self-time-percentage] --list-functions=LIST_FUNCTIONS list fun
Release History
| Version | Changes | Urgency | Date |
|---|---|---|---|
| 2025.4.14 | Imported from PyPI (2025.4.14) | Low | 4/21/2026 |
| 2025.04.14 | ## What's Changed * Remove "%3" tooltip in SVG output by @eltoder in https://github.com/jrfonseca/gprof2dot/pull/101 * Add an option to specify time format by @eltoder in https://github.com/jrfonseca/gprof2dot/pull/102 ## New Contributors * @eltoder made their first contribution in https://github.com/jrfonseca/gprof2dot/pull/101 **Full Changelog**: https://github.com/jrfonseca/gprof2dot/compare/2024.06.06...2025.04.14 | Low | 4/14/2025 |
| 2024.06.06 | ## What's Changed * Change http to https in LICENSE.txt by @mtelka in https://github.com/jrfonseca/gprof2dot/pull/82 * Added support for simulated/embedded gprof output by @DepthDeluxe in https://github.com/jrfonseca/gprof2dot/pull/86 * Fix typos in readme by @hartwork in https://github.com/jrfonseca/gprof2dot/pull/89 * Make GitHub Actions cover oldest and youngest Pythons alive by @hartwork in https://github.com/jrfonseca/gprof2dot/pull/90 * Stop Codecov CI from failing on forks by @hartwork in | Low | 6/6/2024 |
| 2022.07.29 | ## What's Changed * Convert setup.py to setup.cfg by @mwtoews in https://github.com/jrfonseca/gprof2dot/pull/77 ## New Contributors * @mwtoews made their first contribution in https://github.com/jrfonseca/gprof2dot/pull/77 **Full Changelog**: https://github.com/jrfonseca/gprof2dot/compare/2021.02.21...2022.07.29 | Low | 9/9/2023 |
