Skip to main content

StopWatch - library for adding timers and tags in your code for performance monitoring

Project description

k3stopwatch

Action-CI Build Status Documentation Status Package

StopWatch - library for adding timers and tags in your code for performance monitoring

k3stopwatch is a component of pykit3 project: a python3 toolkit set.

StopWatch operates on a notion of "spans" which represent scopes of code for which we want to measure timing. Spans can be nested and placed inside loops for aggregation.

StopWatch requires a root scope which upon completion signifies the end of the round of measurements. On a server, you might use a single request as your root scope.

StopWatch produces two kinds of reports.

  1. Aggregated (see _reported_values).
  2. Non-aggregated or "tracing" (see _reported_traces).

Install

pip install k3stopwatch

Synopsis

import k3stopwatch
sw  = k3stopwatch.StopWatch()

with sw.timer('rwoot'):
    for i in range(50):
         with sw.timer('inner_task'):
             print("do_inner_task(i)")

Author

Zhang Yanpo (张炎泼) drdr.xp@gmail.com

Copyright and License

The MIT License (MIT)

Copyright (c) 2015 Zhang Yanpo (张炎泼) drdr.xp@gmail.com

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

k3stopwatch-0.1.1.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

k3stopwatch-0.1.1-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file k3stopwatch-0.1.1.tar.gz.

File metadata

  • Download URL: k3stopwatch-0.1.1.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6

File hashes

Hashes for k3stopwatch-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8c0e200fe636cdd0b6f2d916c70a0141a5578273bd535a7d76b6947963086109
MD5 1d511a7b81620aab053acc9cbf8ff895
BLAKE2b-256 f3eed12d95a36d4bfb5d7b79a13fc02f9544912660c4b9175d55b8ad1e6ce336

See more details on using hashes here.

File details

Details for the file k3stopwatch-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: k3stopwatch-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6

File hashes

Hashes for k3stopwatch-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 74e5fb49192b51e4792999d31bcb0a116da5ffa6b7e002f1ab1499040a678ab5
MD5 ec52362f68404955f527b687c2d5152a
BLAKE2b-256 cdc9138527bcfc5d5b8417ff5ef06153ff2f22148c344429f5d687bb72ab77ea

See more details on using hashes here.

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