4 ms·
Now that this has come up, can somebody explain me how do profilers work? My main concern being regarding the overhead to the process it adds.
by activatedgeek 9y ago
Now that this has come up, can somebody explain me how do profilers work? My main concern being regarding the overhead to the process it adds.
- alex- 9y agoPyCon 2017 had a really good talk about debuggers [1] which covered how PEP523 [2] is making debugging python 3.6+ code much faster. I think that a profiler is somewhat similar, however instead of, potentially, stopping execution on each line it is collecting data. [1] https://www.youtube.com/watch?v=NdObDUbLjdg https://www.youtube.com/watch?v=NdObDUbLjdg [2] https://www.python.org/dev/peps/pep-0523/ https://www.python.org/dev/peps/pep-0523/
- activatedgeek 9y agoInteresting. Thank you for the link.
- sciurus 9y agoThere are two approaches to profiling: Deterministic profiling monitors every function call to track timing information. This is very precise but adds significant overhead. Statistical profiling samples the call stack periodically to see what functions are running. This is less precise but has less overhead. The overhead varies depending on how frequently you sample and what the sampling mechanism is. StackImpact is a statistical profiler. At a quick glance it looks like they're using threading.Timer to periodically run their profiling functions.
- activatedgeek 9y agoFair enough. Thanks.