Pyflame: A Ptracing Profiler For Python¶
Pyflame is a unique profiling tool that generates flame graphs for Python. Pyflame is the only Python profiler based on the Linux ptrace(2) system call. This allows it to take snapshots of the Python call stack without explicit instrumentation, meaning you can profile a program without modifying its source code! Pyflame is capable of profiling embedded Python interpreters like uWSGI. It fully supports profiling multi-threaded Python programs.
Pyflame is written in C++, with attention to speed and performance. Pyflame
usually introduces less overhead than the builtin
modules, and also emits richer profiling data. The profiling overhead is low
enough that you can use it to profile live processes in production.
- Installing Pyflame
- Using Pyflame
Some existing articles and blog posts on Pyflame include:
- Pyflame: Uber Engineering’s Ptracing Profiler For Python by Evan Klitzke (2016-09)
- Pyflame Dual Interpreter Mode by Evan Klitzke (2016-10)
- Using Uber’s Pyflame and Logs to Tackle Scaling Issues by Benoit Bernard (2017-02)
- Building Pyflame on Centos 6 (Chinese) by Faicker Mo (2017-04)
If you write a new post about Pyflame, please let us know and we’ll add it here!