A simple loop execution time measurement tool.
Project description
LoopTick
一个简单的 Python 循环耗时测量工具。
安装
pip install looptick
本地安装
git clone https://github.com/DBinK/LoopTick
pip install -e .
使用示例
常规方式
from looptick import LoopTick
import time
timer = LoopTick()
for i in range(5):
diff = timer.tick()
print(f"第 {i} 次循环耗时: {diff * timer.NS2MS:.6f} ms")
time.sleep(0.01)
timer.__exit__()
使用上下文方式
from looptick import LoopTick
import time
with LoopTick() as timer:
for i in range(5):
diff = timer.tick()
print(f"第 {i} 次循环耗时: {diff * timer.NS2MS:.6f} ms")
time.sleep(0.01)
输出结果:
(LoopTick) PS C:\IT\LoopTick> & C:\IT\LoopTick\.venv\Scripts\python.exe c:/IT/LoopTick/examples/with_usage.py
第 0 次循环耗时: 0.000000 ms
第 1 次循环耗时: 10.829900 ms
第 2 次循环耗时: 16.055800 ms
第 3 次循环耗时: 14.013400 ms
第 4 次循环耗时: 15.587100 ms
总耗时: 0.056486 秒
平均耗时: 14.121550 ms
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 looptick-0.1.0.tar.gz.
File metadata
- Download URL: looptick-0.1.0.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb9578ea8e9538576a93c30f3ca0f47c7d5f73222436a2b5c64fc679c175493f
|
|
| MD5 |
029d1e831f3648855000437002f3b62a
|
|
| BLAKE2b-256 |
fa61123f58b35b662fce9606e3516c98a94e1590269e2e2a3348ce813668daac
|
Provenance
The following attestation bundles were made for looptick-0.1.0.tar.gz:
Publisher:
python-publish.yml on DBinK/LoopTick
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
looptick-0.1.0.tar.gz -
Subject digest:
bb9578ea8e9538576a93c30f3ca0f47c7d5f73222436a2b5c64fc679c175493f - Sigstore transparency entry: 382980504
- Sigstore integration time:
-
Permalink:
DBinK/LoopTick@7bdb9442de7b758246a5714c278cb89758965b9d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/DBinK
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@7bdb9442de7b758246a5714c278cb89758965b9d -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file looptick-0.1.0-py3-none-any.whl.
File metadata
- Download URL: looptick-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61d1aac2b7c3b31bf866aa4c84491b42812cde2389a0808624c1ddc91c582684
|
|
| MD5 |
31e3d2068d4a5cc909a1cb144397562b
|
|
| BLAKE2b-256 |
40cdccbd7301248463dfc241450dfac84446b9fe635c0d034fba092fdb8234e5
|
Provenance
The following attestation bundles were made for looptick-0.1.0-py3-none-any.whl:
Publisher:
python-publish.yml on DBinK/LoopTick
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
looptick-0.1.0-py3-none-any.whl -
Subject digest:
61d1aac2b7c3b31bf866aa4c84491b42812cde2389a0808624c1ddc91c582684 - Sigstore transparency entry: 382980524
- Sigstore integration time:
-
Permalink:
DBinK/LoopTick@7bdb9442de7b758246a5714c278cb89758965b9d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/DBinK
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@7bdb9442de7b758246a5714c278cb89758965b9d -
Trigger Event:
workflow_dispatch
-
Statement type: