chrono
A (BSD licensed) context manager for timing execution. Useful for benchmarking everyday Python code easily/cleanly.
Usage
Usage is trivial. Simply wrap your code in a Timer context manager. Example:
from chrono import Timer
with Timer() as timed:
# Put whatever logic you want here.
# ``for`` loops are great here for timing things that are very fast.
print("Time spent: {0} seconds".format(timed.elapsed))
Requirements
Python 2.6+ or Python 3.3+ (may work on Python 2.5)
License
BSD
Docs
Shortcomings
This is implemented in pure Python, so it doesn’t have the accuracy a C extension would have. There’s also overhead for the context manager function calls, so don’t use this to bench C code.
That said, for most everyday usage of Python, it’s very helpful.
Running Tests
Setup:
$ git clone https://github.com/toastdriven/chrono.git $ cd chrono $ virtualenv -p python3 env3 $ . env3/bin/activate $ pip install nose
Running:
$ nosetests -s -v tests.py
chrono is maintained with 100% passing tests at all times.
Changelog
- Dev
Added links to the docs
- v1.0.1
Added initial docs
Fixed up the main docstring in Timer
- v1.0.0
Initial release
Metadata
Release files for chrono 1.0.2
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 |
|---|---|---|---|---|
| chrono-1.0.2.tar.gz | 3.1 kB | Without provenance | Details for chrono-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| chrono-1.0.2-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for chrono-1.0.2-py2.py3-none-any.whl |
Total release size: 7.2 kB
Release files / chrono-1.0.2.tar.gz
| Download URL | chrono-1.0.2.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4bf8daa17229cd6df6ef59a96e6c43b845a1df94555190a3117505815685198c
|
|
BLAKE2b-256 checksum How to use checksums |
94a8eb47ef906a298d6f40bb46fd91289237e547210c9d61aa8008bf5925140b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / chrono-1.0.2-py2.py3-none-any.whl
| Download URL | chrono-1.0.2-py2.py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
91c0905cafe915579984ac18c8da631301391e44e9102945eefeadb8498af84b
|
|
BLAKE2b-256 checksum How to use checksums |
be2f40c7dfa0de23a60b7e6e493bb471240688eb4e728eaadef53e1a184334c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for chrono 1.0.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.