A library to measure your method, function execution time.
Project description
PY Profiler
A library to measure your method, function execution time.
Usage
It comes with a really easy api to use, you can add profiler(name = None)
decorator to any method or function you want
to measure its execution time.
E.g:
from src.py_profiler import profiler
@profiler('hello')
def hello():
print('hello')
Access Profiler
- Exec time is in milliseconds
- View as a table
from py_profiler import profiling_service
print(profiling_service.as_table())
No | Name | Total Req | Pending Req | Total Exec Time | Last Exec Time | Highest Exec Time | Request Rate (req/sec) | Avg Time/Request (millis/req) |
---|---|---|---|---|---|---|---|---|
1 | hello | 4 | 0 | 0.046 | 0.005 | 0.029 | 86956.522 | 0.011 |
- Integrate with Flask
- If you are using Flask to implement your Restful API. You can add
profiler_blueprint
to your Flash app.
E.g:
from flask import Flask
from waitress import serve
from py_profiler import profiler_blueprint
app = Flask(__name__)
app.register_blueprint(profiler_blueprint)
serve(
app,
host="0.0.0.0",
port=8080
)
Then you can access the profiler page at: http://127.0.0.1:8080/profiler
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
py_profiler-0.1.1.tar.gz
(4.2 kB
view details)
Built Distribution
File details
Details for the file py_profiler-0.1.1.tar.gz
.
File metadata
- Download URL: py_profiler-0.1.1.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 891bb812b14223d7bd44b432530db6e2d09bcc163d4a0cff55de690fe21986eb |
|
MD5 | 8a0b45901cc09d9dca139a6dae283e6c |
|
BLAKE2b-256 | d5509fa1322e26a6522ec8d7e7262de951b5a44f28c651a683d92a52ea5d3a57 |
File details
Details for the file py_profiler-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: py_profiler-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d11db9fe8830bb4b038cfa8ebadfcb1d602d579ec17cf684e190eab522880e2e |
|
MD5 | ad5236159753ee85a93ab95590006cdd |
|
BLAKE2b-256 | 59f3b001a6e1954608ebd9d2cee30122e133512318c922661cda23401753b884 |