3 ms·
ptrace is quite slow, py-spy reads memory and reconstructs stack frames which is much lower overhead for the profiled app. from their github readme: py-spy
by kapilvt 6y ago
ptrace is quite slow, py-spy reads memory and reconstructs stack frames which is much lower overhead for the profiled app.
from their github readme:
py-spy works by directly reading the memory of the python program using the process_vm_readv system call on Linux, the vm_read call on OSX or the ReadProcessMemory call on Windows.