Skip to main content

Simple stop watch, allowing for timing of a number of tasks.

Project description

Simple stop watch, allowing for timing of a number of tasks, exposing total running time and running time for each named task - inspired by Spring Framework

Usage

import time
from stopwatch.stopwatch import StopWatch

sw = StopWatch("title")

sw.start("eat")
time.sleep(0.12)
sw.stop()

sw.start("sleep")
time.sleep(0.60)
sw.stop()

sw.start("work")
time.sleep(0.35)
sw.stop()

print(sw.pretty_print())

result:

-----------------------------------------
ms     %     Task name
-----------------------------------------
120          eat
605          sleep
351          work
-----------------------------------------
1077         total

Install

Pip

Install via pip:

pip install simple-stopwatch

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

multi-task-stopwatch-0.1.0.tar.gz (2.3 kB view hashes)

Uploaded Source

Built Distribution

multi_task_stopwatch-0.1.0-py3-none-any.whl (2.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page