Skip to main content

Monitor resource usage

Project description

code-meters -- Monitor resource usage of Python code

Example

As a context manager:

from meters import ResourceMeter

with ResourceMeter("Data Processing"):
    data = [x**2 for x in range(1000000)]
# Data Processing: wall time: 0.24156 s (241560 microseconds), CPU time: 0.226669 s (226669 microseconds), memory: 92925952 bytes (88.6211 MiB)

As a function decorator:

from meters import metered

@metered
def process(n):
    return sum([x**3 for x in range(n)])

print(process(1000000))
# process: wall time: 0.310323 s (310323 microseconds), CPU time: 0.291285 s (291285 microseconds), memory: 152657920 bytes (145.586 MiB)
# 249999500000250000000000

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

code-meters-0.0.3.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

code_meters-0.0.3-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file code-meters-0.0.3.tar.gz.

File metadata

  • Download URL: code-meters-0.0.3.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.10

File hashes

Hashes for code-meters-0.0.3.tar.gz
Algorithm Hash digest
SHA256 1c9b9e4f078d0df9290ea48bdeed5d3e7102261c3fccb68253e9fea9071bafdb
MD5 188f4e7d0e67b70bc262d4705f3fcc27
BLAKE2b-256 b7c649cb64fc3f7cdb12f10aad07f5ab7a6a750f81c5fc9c6cd912a7471364cf

See more details on using hashes here.

File details

Details for the file code_meters-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: code_meters-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.10

File hashes

Hashes for code_meters-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d77fbe9bdfb2b50239addc1976a66867dff6031e1c79be5962ede903fba92ef6
MD5 7847535632e74f275622955544f5e814
BLAKE2b-256 453ded5fea1e8b2b6f86116a8fbe7cf50194f488276db86871fce39c74e620fb

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