All Projects → lavi06 → django-profile-middleware

lavi06 / django-profile-middleware

Licence: MIT license
An easy to use customizable django profiling middleware to profile and find bottlenecks in your code and custom middlewares

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to django-profile-middleware

customizable-django-profiler
Customizable cProfileMiddleware for Django
Stars: ✭ 28 (-22.22%)
Mutual labels:  profiler, cprofile
IYFThreading
A C++11 thread pool and profiler
Stars: ✭ 24 (-33.33%)
Mutual labels:  profiler
Startuptime.vim
Breakdown Vim's --startuptime output
Stars: ✭ 180 (+400%)
Mutual labels:  profiler
Androidgodeye
An app performance monitor(APM) , like "Android Studio profiler", you can easily monitor the performance of your app real time in browser
Stars: ✭ 2,430 (+6650%)
Mutual labels:  profiler
Spf4j
Simple performance framework for java
Stars: ✭ 184 (+411.11%)
Mutual labels:  profiler
Pyinstrument
🚴 Call stack profiler for Python. Shows you why your code is slow!
Stars: ✭ 3,870 (+10650%)
Mutual labels:  profiler
Unityheapexplorer
A Memory Profiler, Debugger and Analyzer for Unity 2019.3 and newer.
Stars: ✭ 179 (+397.22%)
Mutual labels:  profiler
VisualProfiler-Unity
The Visual Profiler provides a drop in solution for viewing your mixed reality Unity application's frame rate, scene complexity, and memory usage.
Stars: ✭ 120 (+233.33%)
Mutual labels:  profiler
profiler
Continuous profiling based on pprof
Stars: ✭ 221 (+513.89%)
Mutual labels:  profiler
Liveprof
A performance monitoring system for running on live sites
Stars: ✭ 206 (+472.22%)
Mutual labels:  profiler
Aprof
Java memory allocation profiler
Stars: ✭ 200 (+455.56%)
Mutual labels:  profiler
Myperf4j
High performance Java APM. Powered by ASM. Try it. Test it. If you feel its better, use it.
Stars: ✭ 2,281 (+6236.11%)
Mutual labels:  profiler
Gecko-Profiler-Addon
(deprecated) Addon to control the Gecko Built-in Profiler
Stars: ✭ 20 (-44.44%)
Mutual labels:  profiler
Loli profiler
Memory instrumentation tool for android app&game developers.
Stars: ✭ 179 (+397.22%)
Mutual labels:  profiler
wgpu-profiler
Simple profiler scopes for wgpu using timer queries
Stars: ✭ 45 (+25%)
Mutual labels:  profiler
Nlp profiler
A simple NLP library allows profiling datasets with one or more text columns. When given a dataset and a column name containing text data, NLP Profiler will return either high-level insights or low-level/granular statistical information about the text in that column.
Stars: ✭ 181 (+402.78%)
Mutual labels:  profiler
Cloud Ops Sandbox
Cloud Operations Sandbox is an open source tool that helps practitioners to learn Service Reliability Engineering practices from Google and apply them on their cloud services using Cloud Operations suite of tools.
Stars: ✭ 191 (+430.56%)
Mutual labels:  profiler
Router.cr
Minimum High Performance Middleware for Crystal Web Server.
Stars: ✭ 231 (+541.67%)
Mutual labels:  profiler
live-profiler
Header only library for real time performance analysis, supports c, c++, go, java, .net
Stars: ✭ 18 (-50%)
Mutual labels:  profiler
EasyProfiler
This repo, provides query profiler for .Net
Stars: ✭ 99 (+175%)
Mutual labels:  profiler

django-profile-middleware

An easy to use customizable django profiling middleware for Django VERSION below 1.10. (For version 1.10 or above refer here)

Requirement

Django VERSION below 1.10 and python 2.x

Installation

$ pip install django-profile-middleware

Middleware

Motivation: To provide an easy to use cProfile middleware to find bottlenecks in code.

How To Use (after installation)

In your settings add:

django_profile_middleware.middleware.ProfilerMiddleware to the end your MIDDLEWARE_CLASSES and django_profile_middleware to your INSTALLED_APPS

In case you also want to profile any of your custom middleware, just add all those middlewares below this one.

For example:

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    ....

    'django_profile_middleware.middleware.ProfilerMiddleware',

]

INSTALLED_APPS = [
    ....
    'django_profile_middleware',
    ....
] 

Enable

Add PROFILER in project's settings.py and set enable = True. Also make sure project running in DEBUG mode DEBUG = True

DEBUG = True

PROFILER = {
    'enable': True,
}

And

Profiling results will be printed on the console and will also be saved in a profiling_results.txt file. profiling_results.txt file will be created if not present and updated with the results at end if a file with same name already exists.

Example

        197 function calls (192 primitive calls) in 0.002 seconds

   Ordered by: internal time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
   ...      ...      ...       ...     ...           ...
   ...      ...      ...       ...     ...           ...

Customize

You can customize the Profiler settings via adding optional fields to PROFILER key in settings.py

Default are

PROFILER = {
    'enable': True,

    #optional fields
    'sort': 'time',
    'count': None ,
    'output': ['console','file'],             
    'file_location': 'profiling_results.txt'

}

Description of optional fields

enable

Set this key to True to enable Profiler

'enable': True

To disable set to False

'enable': False

sort

Sort according to the set value. Default is 'time'. See documentaion for more options

count

Specify number of rows to output. By Default it will give all the rows.

output

Specify the form of output. Default is ['console',"file"]. In case only one of them is required just mention that in ou2tput field 'file' will write the file specified by 'file_location' field.

'output': ['console', 'file']  # default value
'output': ['console']

file_location

Specify the location of file you want to write in the results. Only valid if 'file' in 'output' field. Default value profiling_results.txt

Decorator

I have also added a decorator in the package which can be used optionally according to one's requirement.

Motivation: In case API takes very less time say 10 ms to execute, it is difficult to know which function is taking the maximum time, as, even the slowest one may take just 1 ms or even less . So this decorator provides you an option to run the whole code multiple times and thus scaling the total time to a more indicative value.

How To Use (after installation) In your views.py file add :

from django_profile_middleware.decorator import iterator

and at the function you want to run multiple time add decorator:

@iterator( *no. of times you want it to run )

for example:

@iterator(100)

Author

  • Himanshu Goyal

Email me with any questions: [email protected].

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].