"
This article is part of in the series
Last Updated: Wednesday 29th December 2021

Pyflame is new a tool brought to us by Uber's engineering team (you can read about the conception of the idea here) that many Python coders will find very useful. The tool is used to generate flame graphs for Python processes.

8ef7d08c-6a0b-11e6-8bbd-41f82086d862

 

Pyflame works by using the ptrace(2) system call to analyze the currently-executing stack trace for a Python process. The tool is still newly released and has already been embraced by the web development community. It's easy to install and lightweight. The goal of creating Pyflame was to develop a profiler that would collect the full Python stack, emit data in a way that could be used to generate the flame graph, have a low overhead, and work with processes not explicitly meant for profiling. If the ability to do all of these things sounds like it would be instrumental to you, be sure to use Pyflame for your next project.