Native functions can be functions of the Python runtime, or Cythonized functions.
py-spy does not collect native frames at all right now (it supports collection but we don't enable this mode, partially because I'm under impression it's very inaccurate under --nonblocking mode).
PyPerf does collect native frames, but we stop at the first Python function (i.e the first PyEval_EvalFrame*).
If we have a stack like:
python; pyfunc1; pyfunc2; cythonfunc3; cythonfunc4; pyfunc5 ...
then both py-spy and PyPerf will collect it as python; pyfunc1; pyfunc2; pyfunc5 ....
I don't have a good idea for it now, perhaps PyPerf can collect deeper native frames and correlate frames also with frames higher in the stack than the first Python frames?
Native functions can be functions of the Python runtime, or Cythonized functions.
py-spy does not collect native frames at all right now (it supports collection but we don't enable this mode, partially because I'm under impression it's very inaccurate under
--nonblocking
mode). PyPerf does collect native frames, but we stop at the first Python function (i.e the firstPyEval_EvalFrame*
).If we have a stack like:
python; pyfunc1; pyfunc2; cythonfunc3; cythonfunc4; pyfunc5 ...
then both py-spy and PyPerf will collect it aspython; pyfunc1; pyfunc2; pyfunc5 ...
.I don't have a good idea for it now, perhaps PyPerf can collect deeper native frames and correlate frames also with frames higher in the stack than the first Python frames?