Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

package which provides you with a decorator to measure execution time of functions

Project description


Build Status License: MIT

This is a tiny python package which provides you with a decorator to measure execution time of functions.


You should be able to install using pip in the usual ways:

$ pip install execution-time

Or just clone this repository and run:

$ python3 install

Or place the execution_time folder that you downloaded somewhere where it can be accessed by your scripts.

Basic Usage

Import the class ExecutionTime, instantiate it and @obj.timeit decorater becomes available.

from execution_time import ExecutionTime
e = ExecutionTime()

def foo(arg1):

def bar():


## {'foo': 0.12000000000012001, 'bar': 0.11650000000007488}

logdata_time is a dictionary which contains the data in methodname:time took in ms format.

Additonal Features

  1. Auto-Decorate all functions in a script.

This is a shortcut if you want to auto-deocreate all function. To do so, pass the __name__ attribute to the class instantiation as:

from execution_time import ExecutionTime

def foo():

def bar():

e = ExecutionTime(module_name=__name__)



Note: The class instantiation must be done after functions have been defined and before they are called. This does limit where this feature can be used and the decorator approach is recommeneded in those scenarios.

  1. Provide console logs.
e = ExecutionTime(console=True)

Output the log time in console as: 2019-07-06 22:07:55,157 [INFO ] Time take by method : foo is 0.12000000000012001 ms


You can report the bugs at the issue tracker


Built with ♥ by Siddhant Chhabra(@siddhant-curious) under MIT License

You can find a copy of the License at

Project details

Release history Release notifications

This version


Download files

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

Files for Execution-Time, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size Execution_Time-1.0.0-py3-none-any.whl (5.0 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size Execution Time-1.0.0.tar.gz (3.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page