A profile is a set of statistics that describes how often and for how long various parts of the program executed. Most profilers run inside your Python process. If you’re inside a Python program you generally have pretty easy access to its stack, hence we can gather information about time spent in each level.
In this talk we’ll build a Python profiler from scratch and so learn about the dynamic nature of Python and how do well-known profilers such as cProfile.
We’ll also learn the difference between a tracing and a sampling profiler and which one to use in what circumstance.