https://github.com/alyshmahell/pyprofyler
a simple memory profiler for python programs.
https://github.com/alyshmahell/pyprofyler
application memory profiler python
Last synced: 24 days ago
JSON representation
a simple memory profiler for python programs.
- Host: GitHub
- URL: https://github.com/alyshmahell/pyprofyler
- Owner: AlyShmahell
- License: mit
- Created: 2019-03-31T04:46:09.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-06-21T21:51:07.000Z (about 4 years ago)
- Last Synced: 2024-05-02T04:04:52.042Z (about 2 years ago)
- Topics: application, memory, profiler, python
- Language: Python
- Size: 9.77 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PyProfyler
a simple memory profiler for python programs.
## Installation:
```sh
sudo pip3 install git+https://github.com/AlyShmahell/PyProfyler
```
or
```sh
sudo pip3 install pyprofyler
```
## Example:
```python
from pyprofyler import PyProfyler
def wrapped_function():
array = []
for i in range(1,1000000):
array.append(i)
return array
@PyProfyler
def decorated_function():
a_list = []
for i in range(1,1000000):
a_list.append(i)
return a_list
if __name__ == '__main__':
##############################################
# Profiling a function by wrapping it #
##############################################
wrapped_profile = PyProfyler(wrapped_function)
# "Not Profiled Yet" Message
print(wrapped_profile)
result = wrapped_profile()
# Profile Message, through __str__
print(wrapped_profile)
# Function Execution Result
print(f"execution result: {result[10]}")
# Profile Message, through __getitem__
print(wrapped_profile['profile'])
##############################################
# Profiling a decorated function #
##############################################
# "Not Profiled Yet" Message
print(decorated_function)
result = decorated_function()
# Profile Message, through __str__
print(decorated_function)
# Function Execution Result
print(f"execution result: {result[10]}")
# Profile Message, through __getitem__
print(decorated_function['profile'])
```