rawtimer
a simple timer manager.
GitHub repo: https://github.com/GGN-2015/rawtimer
Installation
pip install rawtimer
Usage
import rawtimer
import time
rawtimer.begin_timer("timer_name_1")
time.sleep(2.0) # Do something that you want to time
rawtimer.end_timer("timer_name_1") # this will output a line into stdout
# means do not output to show time cost
with rawtimer.timer_silent():
rawtimer.begin_timer("timer_name_1")
time.sleep(2.0)
time_cost = rawtimer.end_timer("timer_name_1") # silent
print(f"time_cost: {time_cost:13.3f}s") # you can output yourself
# you can use this function to make alignment, if necessary
rawtimer.set_default_min_name_len(30)
# if the timer name begins with character '$', when output, its name will be in yellow
rawtimer.begin_timer("$special_timer_1")
time.sleep(2.0)
rawtimer.end_timer("$special_timer_1")
# if the timer name begins with character '#', when output, its name will be in red
rawtimer.begin_timer("#special_timer_2")
time.sleep(2.0)
rawtimer.end_timer("#special_timer_2")
Metadata
Release files for rawtimer 0.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rawtimer-0.0.0.tar.gz | 3.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rawtimer-0.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.6 kB
Release files / rawtimer-0.0.0.tar.gz
| Download URL | rawtimer-0.0.0.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b19b43ae93b57943c59bbcf196f023dd492197dc045e226d2cf64eae33adf386
|
|
BLAKE2b-256 checksum How to use checksums |
a881f952e9612fd572f4b451df066da7565ec7947647d51b1608553a4a425b3e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.12.7 Linux/6.17.7-aosc-main
|
Release files / rawtimer-0.0.0-py3-none-any.whl
| Download URL | rawtimer-0.0.0-py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c7f3319f95eb30a07d567ea8afdbe94b77c47d43bbd9e513368b0dac67ea903c
|
|
BLAKE2b-256 checksum How to use checksums |
8bad9eed0ec90eb435f7c785e8cc7d0fc2b65b1dd6dfe1ceb4605f169b0956fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.12.7 Linux/6.17.7-aosc-main
|