Skip to main content

jdutimer

Singleton implementation of a timer. This package allows you to measure and summarize executions time.

Installation

> pip(3) install (-U) jdutimer

Methods

def add(self, func, *args)

... to measure the execution time of function.

def pack(self, title)

... to put all previous measured functions in a block with a given title.

def show_block(self, id=-1, unit="ms")

... to show execution time of a given block. The id can either be an integer, or a string. Display unit (s, ds, cs, ms) can be modified.

def show(self, unit="ms")

... to show all execution time blocks. Display unit (s, ds, cs, ms) can be modified.

def rename(self, old, new)

... to rename a given block. old can be the id or the name of the block to rename, new has to be a string.

Example usage

This snippet :

from jdutimer.timer import Timer

def foo(str):
    print(str)

def bar(num):
    print(num)

timer = Timer()
timer.add(foo, "Hello World!")
timer.add(bar, 42)
timer.pack("Display")

timer.show()

Shows this in the console :

Hello World!
42
Display 
        foo        0.04ms
        bar        0.01ms
                   0.04ms
        -----
        TOTAL      0.04ms

Metadata

Release files for jdutimer 0.2.4.1

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

Source distribution (sdist)

Source distribution for jdutimer 0.2.4.1
File Size Uploaded Provenance Actions
jdutimer-0.2.4.1.tar.gz 3.9 kB Without provenance Details for jdutimer-0.2.4.1.tar.gz

Release files / jdutimer-0.2.4.1.tar.gz

Download URL jdutimer-0.2.4.1.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4753fc2c5778a8a8819f39418b7080cda364bc44a78a785d0ba0ee09425023b0
BLAKE2b-256 checksum
How to use checksums
e28274dc9eafb66270388afae4b4ad80dff08b6f88c88c9a2549c0f2c9529e0c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.4

Security for jdutimer 0.2.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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