python package for tracing the performance of python code
Project description
pytracy
PyTracy is a Python package that enables you to profile your code using the Tracy profiler, a real-time, nanosecond-resolution tool designed for games and applications. With minimal performance overhead, PyTracy integrates seamlessly with your Python code and visualizes profiling results in the Tracy profiler interface.
Features
- Low overhead: Tracy profiler introduces only 273ns additional overhead per function call, compared to ~62ns for untraced functions. (See the Performance section for more details.)
- Easy integration: PyTracy integrates seamlessly with your Python code, requiring minimal setup to start profiling.
- Multithreading support: Works with multithreaded applications, including full support for free-threaded Python in version 3.13.
Installation
Download the pytracy package using the following command:
pip install pytracy
You will also need the Tracy profiler to connect to the profiled application. Download it from the Tracy Github releases page.
- For Windows, an executable is provided by the author.
- For Linux, you need to build it from the source. Refer to Tracy documentation for build instructions
Usage
- Enable profiling in your Python code:
import pytracy
pytracy.enable_tracing(True)
- Run your Python script as usual.
- Open the Tracy profiler and click "Connect" to start profiling.
Limitations:
- No support for functions run with multiprocessing.
Performance
PyTracy code impacts the function call and return time, as it has to send those events to the Tracy profiler. To measure that acurately, the we have to compare the time taken by an empty function and a function with the Tracy profiler enabled. This has been done in the utils/testPer.py.
We have measured 3 cases:
- No profiling, just the function call and return
- Tracy profiling enabled
- Profiling enabled, but the profiler callback is an empty function
The third scenario is used to show the overhead of the Python tracing API itself. The results are as follows:
| Case | Time taken per 20 000 000 calls (s) | Time taken per call (ns) |
|---|---|---|
| No Profiling | 6,721 | 62 |
| Tracy profiling enabled | 1,247 | 336 |
| Empty profiling function | 6,339 | 317 |
The overhead of the Tracy profiler is 273ns per function call (336ns - 62ns), where most of the overhead is due to the Python tracing API itself. The overhead of the Python tracing API is 255ns per function call (317ns - 62ns).
Goals for 0.3.0 release
- Add Mac support
- Shutdown and startup during program execution
- Allow runtime switching of tracing modes.
- Easy integration with python logging
Goals for 0.4.0 release
- Offline mode - save trace to file
- Preinitialize all of the code objects, to avoid additional runtime overhead
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytracy-0.0.2-cp313-cp313t-win_amd64.whl.
File metadata
- Download URL: pytracy-0.0.2-cp313-cp313t-win_amd64.whl
- Upload date:
- Size: 124.3 kB
- Tags: CPython 3.13t, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e00f5da2c20eb7448a957a8ad03173acb7fc7eb9d840cc82badb2ac57ece9066
|
|
| MD5 |
dc7076b173dd06daba56d342588edb7f
|
|
| BLAKE2b-256 |
bb23a6449725a9ef0c45811a581292c145ba75bdf660cba6d97bb516b18533a9
|
File details
Details for the file pytracy-0.0.2-cp313-cp313t-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: pytracy-0.0.2-cp313-cp313t-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.13t, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
204567505dc807c61c91b83e8d62ede344b3adbe8f71e92bdada31875c291dec
|
|
| MD5 |
8525ddbf85db5b3353368247a45945e0
|
|
| BLAKE2b-256 |
53718f13042b16ea5a2a599a591bbd6c37694ec541f928cbd1252363c7ffba96
|
File details
Details for the file pytracy-0.0.2-cp313-cp313t-musllinux_1_2_i686.whl.
File metadata
- Download URL: pytracy-0.0.2-cp313-cp313t-musllinux_1_2_i686.whl
- Upload date:
- Size: 2.3 MB
- Tags: CPython 3.13t, musllinux: musl 1.2+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e415fe6825ada475afd6cb1dd4f526ec840bf0a4ee7e14cb20a11b33d3682fd
|
|
| MD5 |
a24def3f88a42ecf0400d5cf79616db1
|
|
| BLAKE2b-256 |
f7a5e55b461bb70883bfcd8166bb43f67dbf24533cce418cb8525d30172ba609
|
File details
Details for the file pytracy-0.0.2-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: pytracy-0.0.2-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.13t, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d1ed15f79f2ae717230ebe2080b5031bab3a7995fb43d7a5c0d9b1ca254c473
|
|
| MD5 |
c60dc2aed54c3d07880f8a484f7b65da
|
|
| BLAKE2b-256 |
774d0d7ad54207f658253b13c3498a0d1c063b879d74a9aa55b30bf2cda037ec
|
File details
Details for the file pytracy-0.0.2-cp313-cp313t-manylinux_2_17_i686.manylinux2014_i686.whl.
File metadata
- Download URL: pytracy-0.0.2-cp313-cp313t-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.13t, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
186ea486ee525155676117e677f4e8bb345cc05646a2578a4e614ea317ef3a68
|
|
| MD5 |
2fe68068ad019e21db3dda9e3cb330ba
|
|
| BLAKE2b-256 |
b97dc36a751adbfa151941749a873df81df78699719c5d16e97882cfe6c526c3
|
File details
Details for the file pytracy-0.0.2-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: pytracy-0.0.2-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 117.3 kB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5d03562afc53d0b7644e9f64ce74ad8a9a0a0f1459db15867f6d859d4699679
|
|
| MD5 |
043c9b1cf4dbffc25da8eec62b33b553
|
|
| BLAKE2b-256 |
54278880e1a1fc59036d663c9c3d75bffd46fd3803dc673c2326eb8d211aacfc
|
File details
Details for the file pytracy-0.0.2-cp313-cp313-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: pytracy-0.0.2-cp313-cp313-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.13, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0cfb3099bc43dd746c8e2556795740336337e94971d859f52f40713c78f084b1
|
|
| MD5 |
eab0869693448bda185c7aa8234f260e
|
|
| BLAKE2b-256 |
c6d1ea5ec327898c314e4043dee77c84b1d69e613f2e4a235fd1bc9656f5df6d
|
File details
Details for the file pytracy-0.0.2-cp313-cp313-musllinux_1_2_i686.whl.
File metadata
- Download URL: pytracy-0.0.2-cp313-cp313-musllinux_1_2_i686.whl
- Upload date:
- Size: 2.3 MB
- Tags: CPython 3.13, musllinux: musl 1.2+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d22e9189584bf9079b90cbb97b542389c08860bd628c5b2049ad78cad42cfca5
|
|
| MD5 |
a6cec7a029f755029f66c6489d6f95b6
|
|
| BLAKE2b-256 |
c47b0c6d337cdfe7737d85a65883c6f48dc3abf507ef392cc5c0122a1490c2ff
|
File details
Details for the file pytracy-0.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: pytracy-0.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
299f73f6db129c069fc5217aeeb3a60d202aad6bfb22a02835aab524e51a7431
|
|
| MD5 |
e7e2c2f2834f007650e76fdfc4ad2e45
|
|
| BLAKE2b-256 |
ae33066c7a70d841c3f4eff410b235e8184eb2bb6fdc86e07efbb949f41d53dc
|
File details
Details for the file pytracy-0.0.2-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl.
File metadata
- Download URL: pytracy-0.0.2-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.13, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b88bab5aa374c32109f51e2e22cff1b4c2a200cb835fcf58018d33192b1939b5
|
|
| MD5 |
aa60e14a2f39c6fe3f72da87635e1ff9
|
|
| BLAKE2b-256 |
536f0dea40f187b0a91ef367e78859ce5fc862417ab0ee383dffaf6fae0d734d
|
File details
Details for the file pytracy-0.0.2-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: pytracy-0.0.2-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 117.3 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b43ef7249e829b5baa9c8766e408a0af922c554ce739060b2a78059335258842
|
|
| MD5 |
788583b725d4e8b15ddc2418d18c7fd9
|
|
| BLAKE2b-256 |
26cdf44d492ac9dbd90d4ddba1fa50253910861e0f8ecc43c843f1dd5a3fc8d3
|
File details
Details for the file pytracy-0.0.2-cp312-cp312-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: pytracy-0.0.2-cp312-cp312-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.12, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa737199fb1b6ceb50a14e52280e8f03b0e78220fa0526ad9f702c6b995a1da4
|
|
| MD5 |
5846e5fc122f65d9ac24c11b652b9c4a
|
|
| BLAKE2b-256 |
87e5e4fd20ed7c172c2bcd6256e3a435b52a92a5cceee167ce556924267cf9b1
|
File details
Details for the file pytracy-0.0.2-cp312-cp312-musllinux_1_2_i686.whl.
File metadata
- Download URL: pytracy-0.0.2-cp312-cp312-musllinux_1_2_i686.whl
- Upload date:
- Size: 2.3 MB
- Tags: CPython 3.12, musllinux: musl 1.2+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c5bde80640d7135ac8ce9b280f596f968d128ed6745deaed5cb6b0339cc4e33
|
|
| MD5 |
340301f29de0201bd09272d0100b06e1
|
|
| BLAKE2b-256 |
e4d9c33b5e1b30b69d60bc7da9ca74aee93b01623f374721f182b08bbb053431
|
File details
Details for the file pytracy-0.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: pytracy-0.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b27d08b8fcf9cf331cc95e35a3a8144bbe897bc809d85cfd1c00ce4b6f49071
|
|
| MD5 |
2d1b587b4195c25b6bc5b0b6a9025223
|
|
| BLAKE2b-256 |
f770cb5468f882f2a6bf971127a904eb9c2cf80a68546fdf0d826fc80cc2b6b9
|
File details
Details for the file pytracy-0.0.2-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl.
File metadata
- Download URL: pytracy-0.0.2-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca9c7b0d1453c3b58322baaf8fa383f72d938ab15c2cb6a24ba231a72e6e752c
|
|
| MD5 |
2b65f37ec90b4358a6057bc1e6cfca5f
|
|
| BLAKE2b-256 |
907edcf9fe9b7cb4a406b5d6e3c0b681c2c71d6e4d7e09deffbad70a0f046f1c
|
File details
Details for the file pytracy-0.0.2-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: pytracy-0.0.2-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 117.0 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47c52e286e6b4fa3577a9d81f32c0026149cefd3eebe82f9d3f6f3b0765cbd89
|
|
| MD5 |
6025b6493305e9153cfae09f8b4adf36
|
|
| BLAKE2b-256 |
7fd23a7f69741d1d51a6defe7d061f99f6645685b8bb3f7319b07840c5d13c19
|
File details
Details for the file pytracy-0.0.2-cp311-cp311-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: pytracy-0.0.2-cp311-cp311-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.11, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1e7e48364f0775d79a54448c4a71a8ee436516b96aa5277937c44a4ec6a6558
|
|
| MD5 |
21669c808f542fdb153447a0981af843
|
|
| BLAKE2b-256 |
cbc8eecde0c54df18c1bce8f70efb7e461236471dc4f528e27bc020df5bc1848
|
File details
Details for the file pytracy-0.0.2-cp311-cp311-musllinux_1_2_i686.whl.
File metadata
- Download URL: pytracy-0.0.2-cp311-cp311-musllinux_1_2_i686.whl
- Upload date:
- Size: 2.3 MB
- Tags: CPython 3.11, musllinux: musl 1.2+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6880144020763bdeb3441eeb3891c9816675e293994dddce537ca2c29078ab41
|
|
| MD5 |
05f30d399d54a45920a16b8ff58ad793
|
|
| BLAKE2b-256 |
7964cf590e4362b287912304040f9c7b3528c3e25b720e69f33711930a6e5799
|
File details
Details for the file pytracy-0.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: pytracy-0.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0fe2e27ca3be729b693de047f8f40057567f0c2fd98cbeaf3afb1b38b180164b
|
|
| MD5 |
84b291ca94bf35d89d2a798fef9d4a5a
|
|
| BLAKE2b-256 |
c0fbbcf9ba3370d8f228b8552c61633b807bfa77834a0af5d7897ff3c11ea2fd
|
File details
Details for the file pytracy-0.0.2-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl.
File metadata
- Download URL: pytracy-0.0.2-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69a981fd62fa3b6b3f6d24561f4763b32f2583985b0fece6cbd7368bb2161df9
|
|
| MD5 |
f167927e4da3769eff390a7b58d78125
|
|
| BLAKE2b-256 |
90edaa86a6f794c06225fc4e3f22e6dff0124ad310beb0b8468ba6b33ad6ecca
|