Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/superstes/python3_profile_wrapper
Wrapper function for built-in profiler
https://github.com/superstes/python3_profile_wrapper
Last synced: 4 days ago
JSON representation
Wrapper function for built-in profiler
- Host: GitHub
- URL: https://github.com/superstes/python3_profile_wrapper
- Owner: superstes
- License: gpl-3.0
- Created: 2023-04-19T18:46:49.000Z (over 1 year ago)
- Default Branch: latest
- Last Pushed: 2023-05-29T18:24:29.000Z (over 1 year ago)
- Last Synced: 2024-12-29T06:11:27.135Z (10 days ago)
- Language: Python
- Homepage:
- Size: 23.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Python3 - Profiler Wrapper
This package provides a wrapper function for easier usage of the built-in profiler.
It only uses builtin modules.
## Install
```bash
python3 -m pip install profiler-wrapper
```See: [PyPI](https://pypi.org/project/profiler_wrapper/)
## Usage
```python3
from profiler_wrapper import profiledef function_to_profile(switch: bool, data: dict, msg: str):
...
return {'data': 'test'}profile(
target=function_to_profile,
args=[True],
kwargs={
'data': {'random': 'test'},
'msg': 'Yesterday is gone.'
},
lines=3,
)# (
# {'data': 'test'},
#
# "270011472 function calls (270011215 primitive calls) in 181.830 seconds
# Ordered by: internal time
#
# ncalls tottime percall cumtime percall filename:lineno(function)
# 1 5.000 5.000 8.000 8.000 /tmp/test.py:95(function_to_profile)
# 2 2.000 2.000 3.000 3.000 /tmp/test.py:89(sub_function)
# 3 1.000 1.000 1.000 1.000 /tmp/test.py:89(sub_function2)
# "
# )```