Skip to main content

The simplest ever library for measuring time of python code execution.

Project description

Build Status Coverage Status PyPI version

The simplest ever library for measuring time of python code execution.


pip install timepy

How to use

from timepy import Timer

It’s simple:

t = Timer()

# Your code which you want to measure

You can give a name fro your timer:

t = Timer('My second timer')

Keep every moment you want

You can

t = Timer()
# Some heavy work 1
t.commit('Work 1 is done')
# Some heave work 2
t.commit('Work 2 is done')


# will output:
# [<TimerStarted: 0.0 s>,
#  <TimerCommitted: 10.0 s (Work 1 is done)>,
#  <TimerCommitted: 20.0 s (Work 2 is done)>,
#  <TimerStopped: 20.001 s>]

Measure your iterations

t = Timer()
for i in some_list:
    # do heavy work

print(t.laps[0])      # <Lap 0: 123 s>
print(t.laps)         # see all laps
print(t.average_lap)  # average lap duration

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

timepy-0.1a.tar.gz (3.4 kB view hashes)

Uploaded source

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