Skip to main content

Time the performance of portions of code and produce a report when done.

Project description

Swiss Time - A diagnostic code timer

Swiss Time is a diagnostic tool for finding slow spots in code. It sits somewhere between a raw timer and a profiler.

<https://github.com/built/swisstime>

Once started, each call to tick() will record a time difference along a label that you provide.

In this way you build a timeline over the portion of code you are analyzing.

You can print a report of the results or gather report data to process your own way.

Usage

Import and start the timer at the beginning of the code you want to analyze.

>>> import swisstime
>>> swisstime.start()

At the end of each section you want measured, call tick() with a description of that piece of code:

>>> swisstime.tick("Load input image")

Do this after each section you are measuring:

>>> swisstime.tick("Build masks")

To display a report of your results, print the output of swisstime.report():

>>> print( swisstime.report() )

Your output will be a table of times and labels for each section you measured.

If you want the raw report data you can call:

>>> swisstime.data()

to get a list of label/time tuples.

Calling start() will reset all data and begin the analysis again.

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

swisstime-0.9.0.tar.gz (2.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

swisstime-0.9.0-py2.py3-none-any.whl (3.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file swisstime-0.9.0.tar.gz.

File metadata

  • Download URL: swisstime-0.9.0.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for swisstime-0.9.0.tar.gz
Algorithm Hash digest
SHA256 671a0404a24a102bab83c790dc4053564b0edb70b9db658313fd74b36c07e84d
MD5 dda3e29450b3a79b146f982ff405e7b7
BLAKE2b-256 d8545c6b696581963b4ef6672c548139672a154fd28f17e69f7764cac93f5883

See more details on using hashes here.

File details

Details for the file swisstime-0.9.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for swisstime-0.9.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 72fb2d34ab9ece9652d7715c64c86718c3e56a2e608d6b793cfea654acef0aa7
MD5 5d6ade5b9b608ceebe63026928f88933
BLAKE2b-256 188a41d1d7453585225968097bf1a0899284768c03305d0bcdd7ca9143f5d7c5

See more details on using hashes here.

Supported by

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