ticktock
Simple Python code metering library.
ticktock is a minimalist library to profile Python code: it periodically displays timing of running code.
Quickstart
First, install ticktock:
pip install py-ticktock
Anywhere in your code you can use tick to start a clock, and tock to register the end of the snippet you want to time:
from ticktock import tick
clock = tick()
# do some work
clock.tock()
This will print the timing of the lines 3 to 5 in your code as so:
⏱️ [3-5] 50us count=1
How is ticktock different?
ticktock becomes really useful when you are trying to time code that is called multiple times.
Rather than printing a new line each time the code is visited, ticktock tracks the times and only prints them every couple of seconds.
ticktock's output is compact and readable, regardless of how many times you run through the code you are timing, or where this code is.
As an example, the following code:
from ticktock import tick
for _ in range(1000):
clock = tick()
# do some work
clock.tock()
Will result in a single, continuously updated line of output showing you the average time and how many times it was called so far:
⏱️ [4-6] 50us count=1000
Documentation
Checkout the documentation for a complete manual.
ticktock is actively being developed, be sure to submit issues or pull requests with ideas!
Metadata
Release files for py-ticktock 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| py_ticktock-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Release files / py_ticktock-0.1.2-py3-none-any.whl
| Download URL | py_ticktock-0.1.2-py3-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f1303e887aa536fb68d22f5e1767fc139a76c1dce46894bdf2a8beab932d6ddd
|
|
BLAKE2b-256 checksum How to use checksums |
dcd830abba7f19f0dc2bdcce8144bdd98e6639a099f951e2fa4000b83fcfdde5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
|
Security for py-ticktock 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.