How we wrote a Python profiler | Datadog
Oct 7, 2020Julien Danjou

Summary
Datadog built a statistical profiler for Python to address the limitations of deterministic profilers like cProfile for production environments. The profiler is designed with minimal overhead and simple deployment, comprising a recorder, collectors (stack, memory, lock), an exporter using the pprof format, and a scheduler. The stack collector, partially written in C with Cython, gathers execution stack information for Python threads and dynamically adjusts its polling rate to manage CPU overhead. Memory and lock collectors are also included to track allocations and lock contention.
More from the Java CPU Profiling trail
- How we built an async-aware Python profiler | Datadog
- Unbiased Java CPU profiling with JFR in JDK 25 | Datadog
- From hand-tuned Go to self-optimizing code: Building BitsEvolve | Datadog
- How we tracked down a Go 1.24 memory regression across hundreds of pods | Datadog
- .NET Continuous Profiler: Exception and lock contention | Datadog