Skip to main content

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


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 details)

Uploaded Source

Built Distribution

timerun-0.1-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file timerun-0.1.tar.gz.

File metadata

  • Download URL: timerun-0.1.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for timerun-0.1.tar.gz
Algorithm Hash digest
SHA256 49fbbbe48cb452d351484683138f3f38e8d9871d033e72cae18f9d927f01e2f4
MD5 02421225768a56e91aec31fae20af4d9
BLAKE2b-256 05c60e55f1a23605c6c8d539f9a4232008a7322edb97aa871fc79c0433bc4c4f

See more details on using hashes here.

File details

Details for the file timerun-0.1-py3-none-any.whl.

File metadata

  • Download URL: timerun-0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for timerun-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 89ea33114af9e214f62962ba1d691e0d9a1cc2aeae910e55fe0033faf94f9940
MD5 9c456c57d2dc768674d4c5d50e985a71
BLAKE2b-256 c67de5dfb003e6b970d31e0c42e71d105682e8b80de307ed6dc34a6a41157b5e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page