https://github.com/ymyzk/wsgi_lineprof
WSGI middleware for line-by-line profiling
https://github.com/ymyzk/wsgi_lineprof
cython hacktoberfest line-profiler profiler python wsgi wsgi-middleware
Last synced: 6 months ago
JSON representation
WSGI middleware for line-by-line profiling
- Host: GitHub
- URL: https://github.com/ymyzk/wsgi_lineprof
- Owner: ymyzk
- License: other
- Created: 2016-10-02T08:11:48.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2025-03-17T17:30:13.000Z (7 months ago)
- Last Synced: 2025-03-29T04:06:28.941Z (6 months ago)
- Topics: cython, hacktoberfest, line-profiler, profiler, python, wsgi, wsgi-middleware
- Language: Python
- Homepage: https://wsgi-lineprof.readthedocs.io/
- Size: 441 KB
- Stars: 49
- Watchers: 3
- Forks: 3
- Open Issues: 9
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
wsgi_lineprof
=============
.. image:: https://badge.fury.io/py/wsgi-lineprof.svg
:target: https://pypi.python.org/pypi/wsgi-lineprof/
:alt: PyPI version
.. image:: https://img.shields.io/pypi/pyversions/wsgi_lineprof.svg
:target: https://pypi.python.org/pypi/wsgi-lineprof/
:alt: PyPI Supported Python Versions
.. image:: https://github.com/ymyzk/wsgi_lineprof/workflows/Tests/badge.svg
:target: https://github.com/ymyzk/wsgi_lineprof/actions?workflow=Tests
:alt: GitHub Actions (Tests)
.. image:: https://readthedocs.org/projects/wsgi_lineprof/badge/?version=latest
:target: https://wsgi-lineprof.readthedocs.io/
:alt: Documentation Status**wsgi_lineprof** is a WSGI middleware for line-by-line profiling.
wsgi_lineprof has the following features:
* *WSGI middleware*: It can be integrated with any WSGI-compatible applications and frameworks including Django, Pyramid, Flask, Bottle, and more.
* *Easily pluggable*: All configurations for profiling in one place. Users don't need to make any changes to their application.wsgi_lineprof is *not recommended to be used in production environment* because of the overhead of profiling.
At a Glance
-----------
You can use wsgi_lineprof as a WSGI middleware of existing applications.::
$ pip install wsgi_lineprof
Apply wsgi_lineprof to the existing WSGI web application:
.. code-block:: python
from wsgi_lineprof.middleware import LineProfilerMiddleware
app = LineProfilerMiddleware(app)Start the web application and access the application.
wsgi_lineprof writes results to stdout every time an HTTP request is processed by default.
You can see the output like this in your console:::
... (snip) ...
File: ./app.py
Name: index
Total time: 1.00518 [sec]
Line Hits Time Code
===================================
9 @app.route('/')
10 def index():
11 1 1005175 time.sleep(1)
12 1 4 return "Hello world!!"... (snip) ...
Also, you can check the result on your web browser by accessing the special endpoint ``/wsgi_lineprof/``.
Please check `the documentation `_ for more details.