Performance analysis for Python.
tuna is a modern, lightweight Python profile viewer inspired by SnakeViz. It handles runtime and import profiles, has no Python dependencies, uses d3 and bootstrap, and avoids certain errors present in SnakeViz.
Create a runtime profile with
python -mcProfile -o program.prof yourfile.py
or an import profile with
python -X importtime yourfile.py 2> import.log
and show it with
tuna program.prof
Why tuna doesn't show the whole call tree
The whole timed call tree cannot be retrieved from profile data. Python developers made the decision to only store parent data in profiles because it can be computed with little overhead. To illustrate, consider the following program.
import time
def a(t0, t1):
c(t0)
d(t1)
return
def b():
return a(1, 4)
def c(t):
time.sleep(t)
return
def d(t):
time.sleep(t)
return
if __name__ == "__main__":
a(4, 1)
b()
The root process (__main__) calls a() which spends 4 seconds in c() and 1 second
in d(). __main__ also calls b() which calls a(), this time spending 1 second in
c() and 4 seconds in d(). The profile, however, will only store that c() spent a
total of 5 seconds when called from a(), and likewise d(). The information that the
program spent more time in c() when called in root -> a() -> c() than when called in
root -> b() -> a() -> c() is not present in the profile.
tuna only displays the part of the timed call tree that can be deduced from the profile:
Installation
tuna is available from the Python Package Index, so simply do
pip install tuna
to install.
Testing
To run the tuna unit tests, check out this repository and type
pytest
License
tuna is published under the MIT license.
Release files for tuna 0.3.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tuna-0.3.6.tar.gz | 125.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tuna-0.3.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 250.4 kB
Release files / tuna-0.3.6.tar.gz
| Download URL | tuna-0.3.6.tar.gz |
|---|---|
| Size | 125.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
27896850d32678be7d1f2e15fea2b2ea8f74852396fdd8358374a14349c1791d
|
|
BLAKE2b-256 checksum How to use checksums |
59aac1eff2139bbb319f236480f30be1e9d1d76a82edd24f7c3ac5aa532b5ba7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.6
|
Release files / tuna-0.3.6-py3-none-any.whl
| Download URL | tuna-0.3.6-py3-none-any.whl |
|---|---|
| Size | 124.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e4f179166c2cd5cb60c04b07454372101e0ab7b9d7fb635ae265d87125d5228d
|
|
BLAKE2b-256 checksum How to use checksums |
4eadc5a5a7c23e3f086ede2ff5821ca83d67759a3006eca927c4ca6b16b42ca9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.6
|