A webservice to facilate the use of pyflame
pip install -r requirements.txt
python wsgi.py
visit http://localhost:5000/
change
localhost
to your host ip
1 get pyflame for py2.6 py2.7 py3.4 py3.5 py3.6 py3.7
curl -o pyflame http://<your-host-ip>:5000/pyflame ; chmod +x pyflame
2.1 start python to profile
./pyflame -t python test.py > profile.txt
2.2 or attach python pid to profile, -s seconds -p pid, reference
sudo ./pyflame -s 5 -p 28947 > profile.txt
2.3 if you need to profile c stack at the same time (when you are curious about idle), add -c
option
sudo ./pyflame -c -s 5 -p 28947 > profile.txt
3 upload to pyflame-server
curl -F "file=@profile.txt" http://<your-host-ip>:5000/upload
4 visit the url printed by curl, samples here
Since the author of uber/pyflame no longer works at uber, the official repo is not well maintained. I forked to Meteorix/pyflame and did the following things:
- Merge PR of py3.7 support
- Merge PR of anaconda fix
- Fix py2.7 build script
- Add Dockerfile to build pyflame which enables py2.6/py2.7/py3.4/py3.5/py3.6/py3.7 support
- Add c/c++ stack profile