About
A module for easily timing sections of code.
Installation
pip install easytimer
Usage
- tick() starts a new section timer and ends the previous section timer
- tock() prints out the runtime for each section so far
- Calling tick() multiple times with the same name adds to a running total for that name
Examples
from easytimer import tick, tock
import time
# Example with unnamed sections
tick()
time.sleep(0.1)
tick()
time.sleep(0.2)
tick()
time.sleep(0.1)
--- Timer Results ---
tick 1 - 0.10s
tick 2 - 0.20s
tick 3 - 0.10s
---------------------
# Example with named sections
tick('Setup')
time.sleep(0.1)
tick('Multi')
time.sleep(0.2)
tick('Intermediate')
time.sleep(0.3)
tick('Multi')
time.sleep(0.4)
tock()
--- Timer Results ---
Setup - 0.10s
Multi - 0.60s
Intermediate - 0.30s
---------------------
# Example with loop
tick("Part A")
time.sleep(0.1)
for i in range(10):
tick('Part B1')
time.sleep(0.02)
tick('Part B2')
time.sleep(0.03)
tick("Part C")
time.sleep(0.4)
tock()
--- Timer Results ---
Part A - 0.10s
Part B1 - 0.20s
Part B2 - 0.30s
Part C - 0.40s
---------------------
Metadata
Release files for easytimer 0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| easytimer-0.3.tar.gz | 2.3 kB | Without provenance | Details for easytimer-0.3.tar.gz |
Release files / easytimer-0.3.tar.gz
| Download URL | easytimer-0.3.tar.gz |
|---|---|
| Size | 2.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
410a50658a4eff3aaa6cd8da0bd28854650a886b0fdfe883c7e4ec85ad1691ce
|
|
BLAKE2b-256 checksum How to use checksums |
a7204db4e0af5b0ec8da77eb77dbab61ebb0ff893def47318e8e4c1b43e31c81
|
| 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/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6
|
Security for easytimer 0.3
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.