Library for execution time measurement
Project description
TimeRun
TimeRun is a Python library for elapsed time measurement.
- Measure elapsed time and format output in one line yet providing the highest resolution for time measurement
- All in a single file with no dependencies other than Python Standard Library
Features
- Elapsed Time Estimator
- Measure elapsed time with sleep
- Measure elapsed time without sleep
- Elapsed Time Formatter
- Format time into hours, minutes, seconds and nanoseconds
- Hide days part if time is less than 1 day
- Shortcut to Time Measurement
- Measure elapsed time for a code block
- Measure elapsed time for a function
Installation
Install TimeRun from Python Package Index
pip install timerun
Install TimeRun from Source Code
python setup.py install
Examples
Measure code block execution time
from timerun import time_code
with time_code('countdown'):
n = 1e6
while n > 0:
n -= 1
countdown - 00:00:00.110983022
Measure function execution time
from timerun import time_func
@time_func
def countdown():
n = 1e6
while n > 0:
n -= 1
countdown()
__main__.countdown - 00:00:00.069651527
License
This project is licensed under the MIT License - see the LICENSE file for details
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
timerun-0.1.tar.gz
(3.6 kB
view hashes)
Built Distribution
timerun-0.1-py3-none-any.whl
(3.8 kB
view hashes)