xerebz / phatstacks

No-fuss Python performance debugging

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

phatstacks

A few useful scripts for debugging Python performance on running processes. No code instrumentation required.

Prerequisites

Depends on pyrasite.

pip install pyrasite

..which depends on gdb.

sudo apt install gdb

On Ubuntu, you'll also need to enable ptrace.

echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope

The user running the process needs read access to these scripts.

Usage

Write the stacktrace of a running program to $HOME/stacktrace-PID.log

pyrasite PID /path/to/phatstacks.py

Start profiling a running program

pyrasite PID /path/to/profstart.py

End profiling and write cProfile output to $HOME/profile-PID.cprof

pyrasite PID /path/to/profend.py

View profiling output using RunSnakeRun or pstats

python -m pstats $HOME/profile-PID.cprof

About

No-fuss Python performance debugging


Languages

Language:Python 100.0%