Introduction to low-level profiling and tracing Офлайн 2021
Christian is a CPython core developer, member of the Python security team, PSF fellow, and frequent contributor to the Python community. He is also a principal software engineer at Red Hat working on the identity management platform FreeIPA.
Python has built-in tracing and profiling facilities in form of callback hooks in the sys module. The settrace and setprofile callbacks have several drawbacks. They slow down the Python interpreter considerable and only allow tracing of Python code. Modern OS and CPUs come with a variety of APIs for efficient and low-level tracing down to system calls, Kernel space code, and hardware events. Some tools even create code that runs in Kernel space.
This talk is an introduction and comparison of various low and high level tools for profiling and tracing as well as visualization tools like flame graphs. It covers ptrace, perf, SystemTap, and BCC/eBPF. Ptrace based commands like strace are easy