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

Uploaded Source

Built Distribution

code_meters-0.0.2-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: code-meters-0.0.2.tar.gz
  • Upload date:
  • Size: 9.9 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.2.tar.gz
Algorithm Hash digest
SHA256 198ea3e20991c89e2751a63486a610deb37dc234147056d47d49347d1170c367
MD5 9386fbb6c3a6b6532102139ecc64a5ae
BLAKE2b-256 64492a5ef6b513a4c496509ea57e696cd8fa64e517e73f5ba9ed54439eeb592e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: code_meters-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.7 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 29532bc14ed49dbc5850af336bce55bb486972db53820684663b9b2bc26d3227
MD5 9ed8bef00048690cd73023e051e71c16
BLAKE2b-256 28dbf0e7c45e9f2ae0bd928a001157fe9d01f9a74be324e7e1e12b286e121a00

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