Skip to main content

Vanilla python clock implementation for easy measurement of functions and with blocks.

Project description

Simple Clock (sclock)

PyPI version

Easy to use clock class, written in vanilla python. Allows to benchmark python code withing a function or with block. Contains multiple time banks for benchmarking different functions or with blocks independently.

Examples

Measuring code in a function as a decorator:

from sclock import Clock
clock = Clock()

@clock("custom_label")
def example_function():
    time.sleep(1)

example_function()
print(clock.get_times("custom_label"))
print(clock.mean_time("custom_label"))

Measuring code in a with block:

from sclock import Clock
clock = Clock()

with clock.using_label("with_code"):
    time.sleep(2)

print(clock.get_times("with_code"))
print(clock.mean_time("with_code"))

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

sclock-0.1.0.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

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

sclock-0.1.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file sclock-0.1.0.tar.gz.

File metadata

  • Download URL: sclock-0.1.0.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.18

File hashes

Hashes for sclock-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6257ff7c371d941f8d48719b90b31d4c1bf0d40485ec1b2b7f050dfb30763cc1
MD5 75c7eca1251b595dd21b83023e3adcd0
BLAKE2b-256 da157bf23866b2e293204ea2a5ab8d9fede47f3270dc0093543ef4f4137911a3

See more details on using hashes here.

File details

Details for the file sclock-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: sclock-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.18

File hashes

Hashes for sclock-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e77835b160235da816771291b13f1587b459480ccc296179adc854f6b04938f4
MD5 59ad73e626aefbe21b5dc83816ff7768
BLAKE2b-256 77ac4244b711042aba0b97176747c91c15f077d411da1c99a9fa1be099cfcc2e

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