Simple Benchmarking Library.
Project description
mbench
Simple benchmarking tool for a module, function, or block of code.
Installation
pip install mbench
Usage
from mbench import profileme
profileme()
def some_function():
print("Hello")
some_function()
Profile Information for
__main__.test_get_object_speed
┏━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┓
┃ Metric ┃ Value ┃
┡━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━┩
│ Duration │ 1.461318 seconds │
│ CPU time │ 24.613764 seconds │
│ Memory usage │ 250.56 MB │
│ GPU usage │ 0.00 B │
│ GPU usages │ │
│ I/O usage │ 0.00 B │
│ Avg Duration │ 0.292264 seconds │
│ Avg CPU time │ 4.922753 seconds │
│ Avg Memory usage │ 50.11 MB │
│ Avg GPU usage │ 0.00 B │
│ Avg GPU usages │ │
│ Avg I/O usage │ 0.00 B │
│ Total calls │ 5 │
└──────────────────┴───────────────────┘
As a Decorator
from mbench import profile
@profile
def some_function():
print("Hello")
As a Context Manager
from mbench import profiling
with profiling:
run_anything()
when calling
Functions you want to profile must
- Be defined in the same module that the
profilemefunction is being called. - Be called after
profileme(when="calling")is called.
when called
Functions you want to profile must
- Be called in the same module that the
profilemefunction is being called. - Be called after
profileme(when="called")is called.
Docs
profileme(when: Literal['called', 'calling'] = 'called')
Profile all functions in a module. Set `when` to 'calling' to profile only the functions called by the target module.
License
mbench is distributed under the terms of the MIT License.
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
mbench-0.0.11.tar.gz
(11.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
mbench-0.0.11-py3-none-any.whl
(12.3 kB
view details)
File details
Details for the file mbench-0.0.11.tar.gz.
File metadata
- Download URL: mbench-0.0.11.tar.gz
- Upload date:
- Size: 11.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c641e8fca748d93b7edb6e2b5d8fe70731e37c43d4f8019efeca850bafe5550
|
|
| MD5 |
1a1a56441fc8e3c727ba72a1a519ec1f
|
|
| BLAKE2b-256 |
970becc5cc451a47a7cab8e9499dda4eafd0034b51b0aeab4880bd789d28e5c3
|
File details
Details for the file mbench-0.0.11-py3-none-any.whl.
File metadata
- Download URL: mbench-0.0.11-py3-none-any.whl
- Upload date:
- Size: 12.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
caf4d73cad4d16403fd6daf5d69172118d54ed935271b22025aec494bd43199c
|
|
| MD5 |
0eb852785620907e69c754ced59a9ae6
|
|
| BLAKE2b-256 |
f40077563a475b269faacd118a61c5072d16df66dce6df4d157630c6573d1a50
|