A Sampling Profiler for Python
Project description
Build Status Windows Build status
Py-Spy is a sampling profiler for Python programs. It lets you visualize what your Python program is spending time on without restarting the program or modifiying the code in any way. Py-Spy is extremely low overhead: it is written in Rust for speed and doesn’t pause or slow down the profiled Python program. This means Py-Spy is safe to use in production.
Py-Spy works on Linux, OSX and Windows, and supports profiling all recent versions of the CPython interpreter (versions 2.3-2.7 and 3.3-3.7).
Installation
Prebuilt binary wheels can be installed from PyPI with:
pip install py-spy
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:
console viewer demo
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:
flame graph
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
Hashes for py_spy-0.1.2-py2.py3-none-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bccd75099d12c6ba14af28758f843353248b12a770c3f01d470ef4ac31540b23 |
|
MD5 | dac8990e11dc05f4ff27a9697d97f0da |
|
BLAKE2b-256 | d7a74cff474ba333caf48834b764a5f1b54274f45a7e120da60f2b8b9f184e59 |
Hashes for py_spy-0.1.2-py2.py3-none-macosx_10_7_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffc431bf4046df8d01c262e7526eee8c08c723cd9eeaa786f03791efb51170bc |
|
MD5 | 323eedfbc33c45b807625a347eeb60ca |
|
BLAKE2b-256 | 77fd3316b612072cc02d7840608c9d665ee178ce9840530163ba766b70dc5235 |
Hashes for py_spy-0.1.2-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55759a59798089d39610a9e4d712ef67fc7cea5f4956f504080f2a80bcbee8e0 |
|
MD5 | 9a76482adc5138d6d00f88e9b0fe8b10 |
|
BLAKE2b-256 | 4d5498e606f96a4ed8096c07e7044c3fbb3a3a9e3b2bc59461a2acd0aa53af2b |
Hashes for py_spy-0.1.2-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7ffdd8e67eb7e60644dcfd9bc5506489406821eb21294300530912b5e6417eb |
|
MD5 | b70464fb4ce214fbd0e250d37f662b57 |
|
BLAKE2b-256 | 25c6a013da8398113d2bfd7f99c3b43e28fc7d39a886e9b7fc591a4ddecf6d4d |
Hashes for py_spy-0.1.2-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7737196b943b23fda093adf1435e90c39f43f955175768c755a854f6ccac434 |
|
MD5 | 55abda2e5edb03a4604fce856d0e6d6b |
|
BLAKE2b-256 | a46e0ca07c335d1c1935384c27656965faf92798d4751e96945c9dd7f36990a3 |
Hashes for py_spy-0.1.2-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ca34cef0fff5283df2cdb877f7d0ded16b66d0cf3edbaf056d4c02673499741 |
|
MD5 | 96f246493012415cf3127387614faf2a |
|
BLAKE2b-256 | fecf0ad51007e9232573e667a2a4a6fc756e6bdc226544aa1cfbb5372e1dbabb |
Hashes for py_spy-0.1.2-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bfd9866aaf6750052b6996af1ce277f1f8da860b6554ea2f3f22e07364a7a53b |
|
MD5 | 98f4342d295c33701687f27565326efb |
|
BLAKE2b-256 | 95db3b026da9db2d7e89f1f72c195183e8bfc55577b8018e6bca8ce0740f6910 |