A simple timer manager.
Project description
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")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
rawtimer-0.0.0.tar.gz
(3.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rawtimer-0.0.0.tar.gz.
File metadata
- Download URL: rawtimer-0.0.0.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.12.7 Linux/6.17.7-aosc-main
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b19b43ae93b57943c59bbcf196f023dd492197dc045e226d2cf64eae33adf386
|
|
| MD5 |
f170c7663906124ae0f13a9ae50970e1
|
|
| BLAKE2b-256 |
a881f952e9612fd572f4b451df066da7565ec7947647d51b1608553a4a425b3e
|
File details
Details for the file rawtimer-0.0.0-py3-none-any.whl.
File metadata
- Download URL: rawtimer-0.0.0-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.12.7 Linux/6.17.7-aosc-main
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7f3319f95eb30a07d567ea8afdbe94b77c47d43bbd9e513368b0dac67ea903c
|
|
| MD5 |
4a72142be61b87af65ee07fca31e7569
|
|
| BLAKE2b-256 |
8bad9eed0ec90eb435f7c785e8cc7d0fc2b65b1dd6dfe1ceb4605f169b0956fc
|