python-dtrace-profiling

Installation
SKILL.md

Python DTrace Profiling Skill

Use this skill when you need an event-by-event view of CPython execution on macOS: Python function entry/return events, source-line events, and their ordering in a real process.

DTrace is instrumentation tracing, not a replacement name for every Python profiler. It observes CPython's static probes and prints a timestamped text stream. Use cProfile/yappi for function call timing, pyinstrument for sampled call stacks, tracemalloc/memray/guppy3 for Python memory behavior, and psutil for process resource snapshots. DTrace is useful when the exact sequence and nesting of interpreter events matters.

When to use it

Choose DTrace when you need to answer questions such as:

  • Which Python functions were entered and returned around a particular operation?
  • Which source lines in program.py executed, and in what order?
  • Did an event happen before or after another event in the running process?
  • Are native/interpreter-level boundaries relevant, rather than only an aggregate profile?

Do not start with DTrace for a broad “what is slow?” question. Begin with the repository's lower-overhead or purpose-built profilers, then use a short DTrace run to explain a specific behavior. DTrace output is raw and often needs filtering or aggregation after the run.

Prerequisites: an instrumented Python

Installs
2
GitHub Stars
2
First Seen
2 days ago
python-dtrace-profiling — rudolfolah/profiling-code