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
Release history Release notifications | RSS feed
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.1.tar.gz
(9.7 kB
view details)
Built Distribution
File details
Details for the file code-meters-0.0.1.tar.gz
.
File metadata
- Download URL: code-meters-0.0.1.tar.gz
- Upload date:
- Size: 9.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d2a9d1b4f74fbf422a1bc8691e8d3dc879151a7c814f19f0ba24886ba4c0321 |
|
MD5 | 563b59550fc922f0aaaa71104f3b56a3 |
|
BLAKE2b-256 | a18b88d989cc80c156eb7a077c1ff6515032c0e0ec08bb4ee2bb3d79ed780b11 |
File details
Details for the file code_meters-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: code_meters-0.0.1-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a9b75f7e3f00de318c230ef53b141871ac463b9936d52889841a1c36d38069c |
|
MD5 | f6daf8d8758e90633050c05575e07d7d |
|
BLAKE2b-256 | 9c9e06350a357c886847dc8f57e8362c4697d25c05efea403d6b4b436e3e3e50 |