Skip to main content

python package for tracing the performance of python code

Project description

pytracy

Installation

Download the pytracy package using the following command: pip install pytracy

To connect to a profiled application, you will need the Tracy profiler. Follow the steps below:

Download Tracy profiler from Tracy Github.

  • For Windows, an executable is provided by the author.
  • For Linux, you need to build it from the source (refer to the documentation for build instructions).
  • Use the provided script for Ubuntu to install dependencies and build the Tracy Profiler - scripts\build_tracy_ubuntu.sh TODO: Should this be included?

Usage

  1. Enable the profiler
import pytracy
pytracy.enable_tracing(True)
  1. Start your script
  2. Start Tracy profiler and click connect

Limitations:

  • Relatively high overhead. Enabling PyTracy currently average ~380ns per function call, compared to ~80ns for an untraced function call. The theoretical limit is an overhead of ~250ns per function call. This has been measured by giving the python profiler an empty function as a profiler callback.
  • set_tracing_mode doesn't work for already started threads. It has to be called before other threads are started.
  • No visibility into functions run using multiprocessing.

Goals for 0.3.0 release

  • Support freethreaded 3.13+ python versions.
  • Shutdown and startup during program execution
  • Changing of the tracing mode during runtime
  • Easy integration with python logging

Goals for 0.4.0 release

  • Offline mode - save trace to file
  • Preinitialize all of the code objects, using gc module

Performance measurements

py .\utils\perf.py

Test Average Std. Deviation
Base 80.00 ns 45.87 ns
python empty profile_function 246.06 ns 47.37 ns
PyTracy Debug(19587f466) 3390.63 ns 375.23 ns
PyTracy Release(19587f466) 1441.24 ns 66.48 ns
PyTracy Release(c6c8c803e) 950.58 ns 113.11 ns
PyTracy Release(a42aa86b5) 760.63 ns 49.53 ns

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pytracy-0.0.2rc4-cp313-cp313-win_amd64.whl (117.0 kB view details)

Uploaded CPython 3.13Windows x86-64

pytracy-0.0.2rc4-cp313-cp313-musllinux_1_2_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

pytracy-0.0.2rc4-cp313-cp313-musllinux_1_2_i686.whl (2.2 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ i686

pytracy-0.0.2rc4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

pytracy-0.0.2rc4-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl (1.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ i686

pytracy-0.0.2rc4-cp312-cp312-win_amd64.whl (117.0 kB view details)

Uploaded CPython 3.12Windows x86-64

pytracy-0.0.2rc4-cp312-cp312-musllinux_1_2_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

pytracy-0.0.2rc4-cp312-cp312-musllinux_1_2_i686.whl (2.2 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ i686

pytracy-0.0.2rc4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

pytracy-0.0.2rc4-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl (1.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ i686

pytracy-0.0.2rc4-cp311-cp311-win_amd64.whl (117.2 kB view details)

Uploaded CPython 3.11Windows x86-64

pytracy-0.0.2rc4-cp311-cp311-musllinux_1_2_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

pytracy-0.0.2rc4-cp311-cp311-musllinux_1_2_i686.whl (2.2 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ i686

pytracy-0.0.2rc4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pytracy-0.0.2rc4-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl (1.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ i686

File details

Details for the file pytracy-0.0.2rc4-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pytracy-0.0.2rc4-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 117.0 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

Hashes for pytracy-0.0.2rc4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 d99889032f0fca0413608907328f038acd0e7f4db3afd7ab257010f1f5912862
MD5 35d7595e1e0945a5590634eef6c21458
BLAKE2b-256 650504a87e24515499a6ef1ed3aee35ebbbd297355e8ae3e6c191543b5bc7630

See more details on using hashes here.

File details

Details for the file pytracy-0.0.2rc4-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pytracy-0.0.2rc4-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 9aa5045c487f65486655b317e27e2b799a45713bbfb64182b2f27cbc0093f9d5
MD5 e2f3c4fa1e0bd7ecfdaaf0d0daa628e6
BLAKE2b-256 0e9414563e8ab036501e264ace06e647288c092c2008bb13d01efcfb616462a3

See more details on using hashes here.

File details

Details for the file pytracy-0.0.2rc4-cp313-cp313-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for pytracy-0.0.2rc4-cp313-cp313-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 a9de6c50c5ebf5383023235c8fc4b34aca075b569821f68487ad4f0d59b103ea
MD5 0e342e96cae8ed62f01484d7a57bfa25
BLAKE2b-256 8e7acd618182bff1e074aee3b7a8496833e5a3dd51352e483836ae4def54725e

See more details on using hashes here.

File details

Details for the file pytracy-0.0.2rc4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pytracy-0.0.2rc4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7604fe69008bc0dfb1a8e6704ff320bc01561e0ceb39c43fe3625546f721defc
MD5 963a45704f08fc5612f0871b50538fa5
BLAKE2b-256 6bb750ee6dedb4de46b89cd1dd15a3d6e7dba926f314ae6699641723a3c94882

See more details on using hashes here.

File details

Details for the file pytracy-0.0.2rc4-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for pytracy-0.0.2rc4-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 7e50a884bbc4b97386a1b3b8fff18a4b677ae55e944dddade77493a713c49f30
MD5 54e02d27d4e6a359e7010afffe810733
BLAKE2b-256 eee8977b85b7074b67666fc50b6585e6323e360458938b98737a76e9c300f4bb

See more details on using hashes here.

File details

Details for the file pytracy-0.0.2rc4-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pytracy-0.0.2rc4-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 117.0 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

Hashes for pytracy-0.0.2rc4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 cbbdcbd3d0c3f5c9b7fa46fd293720b56fe0d2e686d0db6d401c819e85f32372
MD5 8553fe1d256e5b030be0d97fe84acbdc
BLAKE2b-256 7058525c5c7cc8388db72165bb76158890df5d7b424e190f255e471a64997b2c

See more details on using hashes here.

File details

Details for the file pytracy-0.0.2rc4-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pytracy-0.0.2rc4-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 81a3ee935c53bde119f1cdcdd636ab794f95dd443ea09be6fb8401e57a6e59f8
MD5 1e24ed544b50493cc2ce499cfedf731b
BLAKE2b-256 fe216bad8fd2b62ca599e3593de9ccc0c1c792fcc61c561e96ecb247189d44b1

See more details on using hashes here.

File details

Details for the file pytracy-0.0.2rc4-cp312-cp312-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for pytracy-0.0.2rc4-cp312-cp312-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 d92a6a5c1be277ff03d21624e704525d7890f4c8624b782c07f16b98a29e47ad
MD5 12388c61e0926552f24c457d65c60631
BLAKE2b-256 8f7771602e302201c2a72c5494c5804a6823b8fea58712f287ae649705c25328

See more details on using hashes here.

File details

Details for the file pytracy-0.0.2rc4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pytracy-0.0.2rc4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fe7a1a47a55ba3d3e73ea6953237fc3a34a3cc82ac9878ab630bab3f0bc91507
MD5 ad31f0f4fe3567300b0e8c94a15fd576
BLAKE2b-256 e5c9884c47b2164beb821f36f00ad48c584bac176ffc4d4158055266d77d55b9

See more details on using hashes here.

File details

Details for the file pytracy-0.0.2rc4-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for pytracy-0.0.2rc4-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 ba38aacca89178c2790365a0a75d5cb6e66b3e85e3f291ee5265aa9e28ea862f
MD5 65c24a1961fdaa3f66cac42ed2bb9ff9
BLAKE2b-256 bef01cbeaf7b9fdaff98c68f6719ea985d4cf98cb207b142d2bfb0781798e5da

See more details on using hashes here.

File details

Details for the file pytracy-0.0.2rc4-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: pytracy-0.0.2rc4-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 117.2 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

Hashes for pytracy-0.0.2rc4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c0f29daba2c569e70939e98737e749ac08f9c5bd19a0a1b29ab733f1712bee0d
MD5 d0438dbe758244cf3c22a3ddf3a9a555
BLAKE2b-256 5cdfc503dc6e8412d5f50cbfabb8866d26ad11a7c1e24524ba6c9b19994e39a9

See more details on using hashes here.

File details

Details for the file pytracy-0.0.2rc4-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pytracy-0.0.2rc4-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 02898282ee96bb6b62820cc1a434027fccf04078967a0afc0eb2b619fb7cfe21
MD5 c9e56dbffb638a0e45b69aed7d82bb03
BLAKE2b-256 3aeddb65feb7bc4f321a4454bb8d8a0d83a07fee3da0cbbd2bd3fe0f13978ed1

See more details on using hashes here.

File details

Details for the file pytracy-0.0.2rc4-cp311-cp311-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for pytracy-0.0.2rc4-cp311-cp311-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 d598d8ad42a4034a73ca9ebd51dfd0c974cdba94030bb0671c700be80b5a8343
MD5 e6911633e3942bf05234a18e51ac54d7
BLAKE2b-256 cc547878c2d7b32f1b53d63ff1dfafe3333b159d1114704b3f9f8a3573832877

See more details on using hashes here.

File details

Details for the file pytracy-0.0.2rc4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pytracy-0.0.2rc4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0e381905e7a627256074b3f38584530aec3bc2bea0ea344d3cd734445d0ada0e
MD5 67d332bd8e4ea9469f2d86dc0a17051f
BLAKE2b-256 c6339c0f9504063e3ee8c8efdaae2414d6732b9e9740c2e3ffc7736f8b28caa2

See more details on using hashes here.

File details

Details for the file pytracy-0.0.2rc4-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for pytracy-0.0.2rc4-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 f9d2db63b9de991abdd401165765765293cc47e0e4af5e763c25097e33f403b3
MD5 929901756a49a9defdb5acdaca38e57f
BLAKE2b-256 72e8f8960011f9a05d6aca8f62a7aac4e8004e28a8191e52865ba0bdd56f8951

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page