Skip to main content

A simple class to measure code performances.

Project description

Package license Python 3.7+ Latest version released on PyPI Travis build Tests coverage

amtTimer is a Python 3 package that provides a class to measure code performances.

Time points are tagged with a name and multiple measurements of the same time point are aggregated. Statistics on measurements can be built and used for analysis.

Basic Usage

Install with pip:

pip install amtTimer

Import the Timer and TimerSingleton class in your python code, and instanciate it

from amtTimer import Timer, TimerSingleton

myTimer = Timer()

The TimerSingleton class can be used to create a global Timer object.

Adding a new time point can be done inside or outside a context manager.

# new time point with context manager
with myTimer("point_1"):
    # do something

# new time point outside a context manager
point_2 = myTimer("point_2")
# do something

Retrieving the list of time points already defined:

for name in myTimer.names():
    print(f"Time Point {name} is defined")

Statistics are provided by the amtStats module. The values for a particular time point can be obtained with:

results = myTimer.stats("point_1")


Run tests:

$ tox


This package is released under the Apache License 2.0. See the bundled LICENSE file for details.

Project details

Release history Release notifications

Download files

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

Files for amtTimer, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size amtTimer-1.0.0-py3-none-any.whl (8.0 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size amtTimer-1.0.0.tar.gz (3.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page