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

Base Average 80.00 ns dev 45.87 ns python empty profile_function Average 246.06 ns dev 47.37 ns PyTracy Debug(19587f466) Average 3390.63 ns dev 375.23 ns PyTracy Release(19587f466) Average 1441.24 ns dev 66.48 ns PyTracy Release(c6c8c803e) Average 950.58 ns dev 113.11 ns PyTracy Release(a42aa86b5) Average 760.63 ns dev 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.2rc2-cp313-cp313-win_amd64.whl (116.9 kB view details)

Uploaded CPython 3.13Windows x86-64

pytracy-0.0.2rc2-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.2rc2-cp313-cp313-musllinux_1_2_i686.whl (2.2 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ i686

pytracy-0.0.2rc2-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.2rc2-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.2rc2-cp312-cp312-win_amd64.whl (116.9 kB view details)

Uploaded CPython 3.12Windows x86-64

pytracy-0.0.2rc2-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.2rc2-cp312-cp312-musllinux_1_2_i686.whl (2.2 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ i686

pytracy-0.0.2rc2-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.2rc2-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.2rc2-cp311-cp311-win_amd64.whl (117.0 kB view details)

Uploaded CPython 3.11Windows x86-64

pytracy-0.0.2rc2-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.2rc2-cp311-cp311-musllinux_1_2_i686.whl (2.2 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ i686

pytracy-0.0.2rc2-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.2rc2-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.2rc2-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pytracy-0.0.2rc2-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 116.9 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.2rc2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 e91b2578f0e210cf530cdffa5c4de62498b8d85506a45b4f835285a50e983684
MD5 0a5c13a2de817cbd63b0f91d3e681ced
BLAKE2b-256 f6f7f2760b06dc43e419f098a7eff83e8f6ce44b93dd0f3a210cb5a673758325

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytracy-0.0.2rc2-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 bde1db9ce44f5ee63eca8e2ed1c30c30711ad0d5e7afa3a7ceecab865c8c4634
MD5 1f7c4a1ec366e3642609718b5b0e06ec
BLAKE2b-256 0b3fd118d61d55bce158e05623478d5a3d99c20674469ce415c478f627f1bafb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytracy-0.0.2rc2-cp313-cp313-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 bf9facf89d8ee9e9c9bfa20830427611b60a5d6524e3b6c8d4364c97305fae73
MD5 132908e000091e3773e999d191450b3d
BLAKE2b-256 dd0e5eeb41fbc846836980b90e5b65a349153c64a70825400b6e7f4c69590ee1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytracy-0.0.2rc2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7aee1c6710e2bcf6de398ae22c698db79a6dace2244924f6b9617c6a984bbe73
MD5 8d96c3c3927504dde9c346465f090f33
BLAKE2b-256 336d685ceb0d6939408eee12f6232cdf95b894c03feb21afa72f8497efcd7e3e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytracy-0.0.2rc2-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 9d245f6194ebeec62ebaf3b9fc474fd0de88f287fb1251ce037156b172c0f7eb
MD5 b2844581189a4cd7b71cf7352116fbc2
BLAKE2b-256 cfa89544e603999ac46545f3fc007419b04089e28cd623c55ac6470b16690401

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pytracy-0.0.2rc2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 116.9 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.2rc2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 aa5a07fdd9214019bfb375a26b9628763a4f8b0b9ed8f1e2938eda4f365e7da9
MD5 8cca71113c638889610cf02965076635
BLAKE2b-256 f469e7955ca5fc67cd695ecc5fb011fa547624c2317ac94ac16e911626cd862b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytracy-0.0.2rc2-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 b8b1eb9e0f77b3374f99203443015712c9da6937f8f51fff55b272e106b71334
MD5 534a75cc4fc8e79058fd65e174dd2682
BLAKE2b-256 64cdd1b4a419b79dc5cf6abba1174ca8abaf63b4258ac329d055cfd90e1b4db5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytracy-0.0.2rc2-cp312-cp312-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 fa094995aa54106a109f2a8571b628c25e0a067e8b2112b0be37e5e49374a1e2
MD5 24471e7d0adfb08063d2bad741fc158c
BLAKE2b-256 5fb064c738449db822d21178fc1a07a4b0e5671fc714b99cc5d59dc251a3b1db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytracy-0.0.2rc2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1492d806528dcfc6fa372dd0b2060d2fede48b3901eee10223ccfd5073eaa653
MD5 6bd450d14b7ae34aed4cec6a38fc9129
BLAKE2b-256 542b391aebec048143bc173c189c7e3e67f4a989ec49d889908f82f28110da0b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytracy-0.0.2rc2-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 877dd5de7c534cdad42f13c06900d552271b30cdb17bf3cc9429cc7bff785950
MD5 876e5922b50416aacf1d48259614db7d
BLAKE2b-256 980bff36419c0944099df80fe23be998ceb31ef0dd3089db55872f3034fdf699

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pytracy-0.0.2rc2-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

Hashes for pytracy-0.0.2rc2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 881f378de5c14c58415cce8b863d00e1df622814d0e0655c243ef86f7f48603d
MD5 34dd10165230ea1ff54c8f38b9dd9d9e
BLAKE2b-256 b069ffdce1f60ffdf71c26598e13f7bd6d4d06ab028e402ebfc2e1cb39737192

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytracy-0.0.2rc2-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 34c8059f69825d7ac0849e71c7eddf5102b5236beed1aa6d7172e6c101b6ed0f
MD5 cb49b99c83874b32ef79d3a3690d59a5
BLAKE2b-256 0050ac402812298328979269aeccd88ab87448f3799fe32e4df50d501390f19e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytracy-0.0.2rc2-cp311-cp311-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 4fa9d55468f0226ac24a5f68e44d73e8dabed3734a1dad1ba580ca4c9ea13ced
MD5 7ebf79916d2d6d268670d4f54f59a3c0
BLAKE2b-256 00c6479402886b8f2368f2b36fb472616b4de89392bce8f3cb1d1182c87599a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytracy-0.0.2rc2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 baab7cc498217862c42f58effed8af57945734ce5da2095b0eacb6a580f0a715
MD5 cbfd6c970a0f934d41aba296e629f691
BLAKE2b-256 8cd4f0d81e083ed23bba5df7befe759cf9cfedc5b7a8e787c83525c6b96c9cca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytracy-0.0.2rc2-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 811771c749f6ac8b279f62a8dba85e7ebf12c85ad1ee17406eb7118145d105e3
MD5 40bf8a01ac12c97e41f1afb74d6689de
BLAKE2b-256 679fad7e6a02d4972ba4ae241686bd70fc35694ad8ab4201671f71afdf2df6f0

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