Skip to main content

Hierarchical timing measurement with aggregated and tracing reports

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.2.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

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

k3stopwatch-0.1.2-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: k3stopwatch-0.1.2.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for k3stopwatch-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f0c9a72bfe6bc71805bb815fbf54a5d23b469b4c1aeda3671042adac1cc1b234
MD5 cc6e9679602994fd08df0645691ab2bd
BLAKE2b-256 59253bc15343b15eba9c0d10ee19ae1abee996bda4f215aa12ea3e2bc993d7e0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: k3stopwatch-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for k3stopwatch-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e77c6d90eb144baf5026cdae9eee5cfbd98afd439e1c033dd93b8d3bcbcb0603
MD5 def6eeb09e1f6216bdf5e240b5e8636c
BLAKE2b-256 8c78e07d023d5d7cee839aaa99520711c1cf129b6c251458c4c461f80fced4f7

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