| Name | mbench JSON |
| Version |
0.0.11
JSON |
| download |
| home_page | None |
| Summary | Simple Benchmarking Library. |
| upload_time | 2024-08-29 07:25:55 |
| maintainer | None |
| docs_url | None |
| author | None |
| requires_python | >=3.10 |
| license | None |
| keywords |
|
| VCS |
 |
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
# mbench
[](https://pypi.org/project/mbench)
[](https://pypi.org/project/mbench)
-----
Simple benchmarking tool for a module, function, or block of code.
## Installation
```console
pip install mbench
```
## Usage
```python
from mbench import profileme
profileme()
def some_function():
print("Hello")
some_function()
```
```console
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
```python
from mbench import profile
@profile
def some_function():
print("Hello")
```
### As a Context Manager
```python
from mbench import profiling
with profiling:
run_anything()
```
## _when_ calling
Functions you want to profile must
1. Be _defined_ in the same module that the `profileme` function is being called.
2. Be called after `profileme(when="calling")` is called.
## _when_ called
Functions you want to profile must
1. Be _called_ in the same module that the `profileme` function is being called.
2. Be called after `profileme(when="called")` is called.
## Docs
```python
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](LICENSE).
Raw data
{
"_id": null,
"home_page": null,
"name": "mbench",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": null,
"author": null,
"author_email": "Mbodi AI <info@mbodi.ai>",
"download_url": "https://files.pythonhosted.org/packages/97/0b/ecc5cc451a47a7cab8e9499dda4eafd0034b51b0aeab4880bd789d28e5c3/mbench-0.0.11.tar.gz",
"platform": null,
"description": "# mbench\n\n[](https://pypi.org/project/mbench)\n[](https://pypi.org/project/mbench)\n\n-----\n\nSimple benchmarking tool for a module, function, or block of code.\n\n\n## Installation\n\n```console\npip install mbench\n```\n\n## Usage\n\n```python\nfrom mbench import profileme\nprofileme()\n\ndef some_function():\n print(\"Hello\")\n\nsome_function()\n```\n```console\n Profile Information for \n __main__.test_get_object_speed \n\u250f\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2533\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n\u2503 Metric \u2503 Value \u2503\n\u2521\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2547\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2529\n\u2502 Duration \u2502 1.461318 seconds \u2502\n\u2502 CPU time \u2502 24.613764 seconds \u2502\n\u2502 Memory usage \u2502 250.56 MB \u2502\n\u2502 GPU usage \u2502 0.00 B \u2502\n\u2502 GPU usages \u2502 \u2502\n\u2502 I/O usage \u2502 0.00 B \u2502\n\u2502 Avg Duration \u2502 0.292264 seconds \u2502\n\u2502 Avg CPU time \u2502 4.922753 seconds \u2502\n\u2502 Avg Memory usage \u2502 50.11 MB \u2502\n\u2502 Avg GPU usage \u2502 0.00 B \u2502\n\u2502 Avg GPU usages \u2502 \u2502\n\u2502 Avg I/O usage \u2502 0.00 B \u2502\n\u2502 Total calls \u2502 5 \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n```\n### As a Decorator\n\n```python\nfrom mbench import profile\n@profile\ndef some_function():\n print(\"Hello\")\n```\n\n### As a Context Manager\n```python\n\nfrom mbench import profiling\nwith profiling:\n run_anything()\n```\n\n## _when_ calling\n\nFunctions you want to profile must\n\n1. Be _defined_ in the same module that the `profileme` function is being called.\n2. Be called after `profileme(when=\"calling\")` is called.\n\n## _when_ called\n\nFunctions you want to profile must\n\n1. Be _called_ in the same module that the `profileme` function is being called.\n2. Be called after `profileme(when=\"called\")` is called.\n\n## Docs\n```python\nprofileme(when: Literal['called', 'calling'] = 'called')\n Profile all functions in a module. Set `when` to 'calling' to profile only the functions called by the target module.\n```\n## License\n\n`mbench` is distributed under the terms of the [MIT License](LICENSE).\n",
"bugtrack_url": null,
"license": null,
"summary": "Simple Benchmarking Library.",
"version": "0.0.11",
"project_urls": {
"Documentation": "https://github.com/mbodiai/mbench#readme",
"Issues": "https://github.com/mbodiai/mbench/issues",
"Source": "https://github.com/mbodiai/mbench"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "f40077563a475b269faacd118a61c5072d16df66dce6df4d157630c6573d1a50",
"md5": "0eb852785620907e69c754ced59a9ae6",
"sha256": "caf4d73cad4d16403fd6daf5d69172118d54ed935271b22025aec494bd43199c"
},
"downloads": -1,
"filename": "mbench-0.0.11-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0eb852785620907e69c754ced59a9ae6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 12326,
"upload_time": "2024-08-29T07:25:54",
"upload_time_iso_8601": "2024-08-29T07:25:54.172918Z",
"url": "https://files.pythonhosted.org/packages/f4/00/77563a475b269faacd118a61c5072d16df66dce6df4d157630c6573d1a50/mbench-0.0.11-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "970becc5cc451a47a7cab8e9499dda4eafd0034b51b0aeab4880bd789d28e5c3",
"md5": "1a1a56441fc8e3c727ba72a1a519ec1f",
"sha256": "4c641e8fca748d93b7edb6e2b5d8fe70731e37c43d4f8019efeca850bafe5550"
},
"downloads": -1,
"filename": "mbench-0.0.11.tar.gz",
"has_sig": false,
"md5_digest": "1a1a56441fc8e3c727ba72a1a519ec1f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 11869,
"upload_time": "2024-08-29T07:25:55",
"upload_time_iso_8601": "2024-08-29T07:25:55.119218Z",
"url": "https://files.pythonhosted.org/packages/97/0b/ecc5cc451a47a7cab8e9499dda4eafd0034b51b0aeab4880bd789d28e5c3/mbench-0.0.11.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-29 07:25:55",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mbodiai",
"github_project": "mbench#readme",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "mbench"
}