free-threaded-compatibility icon indicating copy to clipboard operation
free-threaded-compatibility copied to clipboard

Document how to use samply on Linux to generate multithreaded profiles

Open ngoldbaum opened this issue 9 months ago • 0 comments

If you combine samply and the JIT monitoring tools introduced in Python 3.12, you can generate multithreaded profiles that include information about both native frames and Python frames:

Image

Here the blue frames are Python functions and the yellow frames are native functions. Samply generates reports that are viewable by profiler.firefox.com - no need to mess with flame graph SVG files!

I generated that profile running the libcst CLI using the following command:

samply record PYTHON_GIL=0 python3 -X perf -m libcst.tool codemod --no-format convert_format_to_fstring.ConvertFormatStringCommand .

ngoldbaum avatar Apr 02 '25 14:04 ngoldbaum