Skip to main content

Measure execution time of code sections.

Project description


Measure execution time of code sections.


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

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

>>>TIME ELAPSED: 0:00:01.400193

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for timerpy, version 1.1.0
Filename, size File type Python version Upload date Hashes
Filename, size timerpy-1.1.0.tar.gz (2.0 kB) File type Source Python version None Upload date Hashes View
Filename, size timerpy-1.1.0-py3-none-any.whl (3.2 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page