A Sampling Profiler for Python
Project description
py-spy is a fast sampling profiler for Python programs. py-spy lets you visualize what your Python program is doing without restarting the program or modifying the code in any way. py-spy is low overhead and won’t pause or slow your Python program down - meaning that it is safe to use in production.
To install:
pip install py-spy
py-spy supports Python versions 2.3+ and 3.3+ on Linux, OSX and Windows.
Usage
py-spy works from the command line, and takes either the PID of the program you want to sample from, or the command line of the python program you want to run:
py-spy --pid 12345
# OR
py-spy -- python myprogram.py
The default visualization is a top-like live view of your python program:
There is also support for generating flame graphs from the running process:
py-spy --flame profile.svg --pid 12345
# OR
py-spy --flame profile.svg -- python myprogram.py
Which will generate a SVG file looking like:
Credits
py-spy is heavily inspired by Julia Evans excellent work on rbspy. In particular the code to generate the flamegraphs is taken directly from rbspy, and this project use several crates (read-process-memory and proc-maps) that were spun off from rbspy.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
File details
Details for the file py_spy-0.1.0-py2.py3-none-manylinux1_x86_64.whl
.
File metadata
- Download URL: py_spy-0.1.0-py2.py3-none-manylinux1_x86_64.whl
- Upload date:
- Size: 5.7 MB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/36.5.0.post20170921 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d539e7ad732dcd1f5e14bbeee61b9e1ce723dbfe729fedeb4455604efda6d5dd |
|
MD5 | 4ecdeb4d80a85bfa32e835814dc689ba |
|
BLAKE2b-256 | 5170e8bfeeac2c57f3af9988ca6d6d12cff3a9a1394e0d9a2c63f08555c0552f |
File details
Details for the file py_spy-0.1.0-py2.py3-none-macosx_10_7_x86_64.whl
.
File metadata
- Download URL: py_spy-0.1.0-py2.py3-none-macosx_10_7_x86_64.whl
- Upload date:
- Size: 3.0 MB
- Tags: Python 2, Python 3, macOS 10.7+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/36.5.0.post20170921 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | afcf0588d658b90dcabef989fc16ed38f6c9f2939cfca6772ded28c2ade0cb66 |
|
MD5 | a2c671fcc07856ccb619c35ff94ed151 |
|
BLAKE2b-256 | 213a9960cd0e251bd156e78c009a7af26059d99f05aaeb6524249ebb35914401 |