yumeow-timer
Lightweight timing utilities for optional performance diagnostics.
Installation
pip install yumeow-timer
Usage
Basic Timer
from yumeow_timer import Timer
timer = Timer()
for i in range(1000):
# do something
timer.add()
print(timer) # Timer(time=1.23 s, count=1.00 kiter, pace=1.23 ms/iter, speed=813 iter/s)
print(timer.to_str('pace')) # 1.23 ms/iter
NamedTimer (Multiple Categories)
from yumeow_timer import NamedTimer
timer = NamedTimer()
for i in range(1000):
if i % 2 == 0:
timer.add("even")
else:
timer.add("odd")
print(timer) # 1.23 ms/iter (even=1.23 ms/iter[50%]; odd=1.23 ms/iter[50%])
print(timer.to_str('pace', mode_of_detail='pace', mode_of_percent='by_count'))
ParallelTimer (Shared Time)
from yumeow_timer import ParallelTimer
timer = ParallelTimer()
for i in range(1000):
timer.add("process", n=1)
timer.add("render", n=1)
print(timer) # Shows shared time with separate counts
Humanize Functions
from yumeow_timer import humanize_time, humanize_count, humanize_pace, humanize_speed
print(humanize_time(3661)) # 1.02 h
print(humanize_count(1500)) # 1.50 kiter
print(humanize_pace(0.00123)) # 1.23 ms/iter
print(humanize_speed(813)) # 813 iter/s
API Reference
Timer
Basic timer that tracks time and count.
add(n=1, by="increment")- Add count and elapsed timeclear(reset_last_add_time=False)- Reset timerto_str(mode="pace")- Get human-readable string- Properties:
time,count,pace,speed
NamedTimer
Extends Timer to track multiple named categories with separate time tracking.
ParallelTimer
Extends Timer to track multiple named categories with shared time.
License
MIT License - See LICENSE file for details.
Metadata
Release files for yumeow-timer 0.2.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 | |
|---|---|---|---|
| yumeow_timer-0.2.0.tar.gz | 7.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| yumeow_timer-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.9 kB
Release files / yumeow_timer-0.2.0.tar.gz
| Download URL | yumeow_timer-0.2.0.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
08cae9f9c2dacab59faf85727150ac1c57ea569e326777835cfb4543ddd1fd4b
|
|
BLAKE2b-256 checksum How to use checksums |
7a2d2c641360e28b1d0cab9afd9717286447067e6c3af94d518e1fbf52ec966b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.4
|
Release files / yumeow_timer-0.2.0-py3-none-any.whl
| Download URL | yumeow_timer-0.2.0-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
decba2f7d74be36e20ed514aad88566defc81a9969afa0d7dec9be4565a4b885
|
|
BLAKE2b-256 checksum How to use checksums |
8f4cc0910c966a3ff0ff0dcef51032068e39c2df650f7e1de6a9726dc9fb6b97
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.4
|