Skip to main content

Measure execution time of code sections.

Project description

timerpy

Measure execution time of code sections.

Installation

python3 -m pip install timerpy

Usage Examples

from timerpy import Timer
with Timer():
    # Some code

>>>TIME ELAPSED: 0:00:01.199748


# Specify message
with Timer('HELLO WORLD'):
    # Some code

>>>HELLO WORLD TIME ELAPSED: 0:02:15.242731


# Specify output
from logging import info # Write to log file
with Timer('HELLO WORLD', info):
    # Some code

>>>timer.py: INFO: stop(): 44:	HELLO WORLD TIME ELAPSED: 0:00:01.200157


# Get elapsed time as float value
with Timer() as timer1:
    # Some code
nanoseconds = timer1.elapsed_time
print(nanoseconds)

>>>TIME ELAPSED: 0:00:01.400193
>>>1400192600

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

timerpy-1.1.0.tar.gz (2.0 kB view details)

Uploaded Source

Built Distribution

timerpy-1.1.0-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file timerpy-1.1.0.tar.gz.

File metadata

  • Download URL: timerpy-1.1.0.tar.gz
  • Upload date:
  • Size: 2.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0

File hashes

Hashes for timerpy-1.1.0.tar.gz
Algorithm Hash digest
SHA256 6db4c45d517e56eae1c56842dd7614e187bd6436c7ed31ed14e4bd3c9c0d567a
MD5 bef33fae906d4da0040122410b9e90b6
BLAKE2b-256 de1e282b27194b757b0ca91e0ddea3550beef8b617fafecb5451a44e55b21056

See more details on using hashes here.

File details

Details for the file timerpy-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: timerpy-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.2 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/40.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0

File hashes

Hashes for timerpy-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 83dd4459411b0dba4e1d77243a210dca615556740ee035754fae5f6c1ab96ea3
MD5 9f7ac5add40dce611f42864b3a423ec2
BLAKE2b-256 6257822af3f492752aeaa80994fecf7ce2e6a71c5156682c7dacbce9455f38bd

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