Skip to main content

Measures the execution time of a block of code. Uses perf_counter for the measurement. Behaves like a float (seconds) when printed or used within an arithmetic context.

Example

from cmtimer import Timer

with Timer() as time:
    # Three hours too soon or a minute too late?

print(f"Time taken: {time:.2f} s")

Installation

pip3 install cmtimer

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cmtimer-0.0.1.tar.gz (2.1 kB view details)

Uploaded Source

File details

Details for the file cmtimer-0.0.1.tar.gz.

File metadata

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

File hashes

Hashes for cmtimer-0.0.1.tar.gz
Algorithm Hash digest
SHA256 6418eee420996da94bad3c22a1fc117ffb29af80bcb0624b661b3a6860fa9807
MD5 c2d5df605106d9167770363995938878
BLAKE2b-256 69e5e0b462becea28569145226c0856a9b6cf21f50f1ed0b39dd67ae8a0ca419

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 file

Supported by

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