Skip to main content
https://travis-ci.com/sigvaldm/TaskTimer.svg?branch=master https://coveralls.io/repos/github/sigvaldm/TaskTimer/badge.svg?branch=master https://img.shields.io/pypi/pyversions/TaskTimer.svg

Indicates progress during runtime, while keeping track of time consumed by user-defined tasks. Not quite a progress bar, not quite a profiler, but something in between which I personally have found to be very handy, especially when working with computationally intensive programs.

Consider this simple dummy program:

from tasktimer import TaskTimer
from time import sleep

timer = TaskTimer()

for n in timer.range(40):

    timer.task('Assembling load vector (b)')
    sleep(0.1) # Dummy

    timer.task('Solving linear system Au=b')
    sleep(0.5) # Dummy

print(timer)

The task() method is used to indicate that from now on the program is working on another task. TaskTimer will indicate progress, and display the current task, for instance:

Step 11/40 (28%). 17.5s of 24.1s remaining. Assembling load vector (b)

When all tasks are completed, print(timer) can be used to print statistics of the tasks:

                             #   Mean   StDev  Total    %
Assembling load vector (b)  40  101ms  89.2us  4.02s   17
Solving linear system Au=b  40  501ms   140us  20.0s   83
Total                                          24.1s  100

Many more options than demonstrated here are available, and the functionality is extensively documented in the docstrings. For instance, customization of the progress string (see TaskTimer), iterating over general iterables using the iterate() method, sorting the statistics (see the summary() method). The time tracking of the individual tasks are performed by the Timer class, which can also be used stand-alone.

Installation

Install from PyPI using pip:

pip install TaskTimer

Or download the GitHub repository https://github.com/sigvaldm/TaskTimer.git and run:

python setup.py install

Metadata

Release files for TaskTimer 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for TaskTimer 1.0.4
File Size Uploaded
tasktimer-1.0.4.tar.gz 7.7 kB Details

Release files / tasktimer-1.0.4.tar.gz

Download URL tasktimer-1.0.4.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7a06453597ee5d779ea4163bf5ba4430bf8097003738f044d6b02f83f4a98478
BLAKE2b-256 checksum
How to use checksums
318d6722accfd312e52e71cb061457215ed864f5c3c3eed9ad90e3b744868ca1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.2 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0a4+

Release history Release notifications | RSS feed

This release

1.0.4 This release

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page