Skip to main content

Measures execution time of Python functions using decorators.

Project description

timedfunc

An easy way to measure execution time of Python functions using decorators.

Installation

pip install timedfunc

Example

from timedfunc import timedfunc

@timedfunc
def my_function(x):
	print("doing stuff that takes some time...")
	import time
	time.sleep((x + 1) * 0.100) # simulate a computation

for i in range(3):
	my_function(i)

output:

doing stuff that takes some time...
doing stuff that takes some time...
doing stuff that takes some time...
--------------------------------+----------+--------------+--------------+--------------
 timed functions                |    calls |          min |         mean |          max
--------------------------------+----------+--------------+--------------+--------------
 my_function                    |        3 |      0.111 s |      0.207 s |      0.310 s
--------------------------------+----------+--------------+--------------+--------------

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 timedfunc, version 1.1.2
Filename, size File type Python version Upload date Hashes
Filename, size timedfunc-1.1.2-py2.py3-none-any.whl (3.5 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size timedfunc-1.1.2.tar.gz (3.2 kB) File type Source Python version None Upload date Hashes View

Supported by

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