Django profiling » History » Version 5
Alex V Koval, 03/02/2015 07:41 PM
1 | 1 | Alex V Koval | h1. Django profiling |
---|---|---|---|
2 | |||
3 | Decorator from https://code.djangoproject.com/wiki/ProfilingDjango available via DjHDGutils.profiling |
||
4 | |||
5 | 4 | Alex V Koval | Usage is simple: add @profile('filename') as a decorator for view or function you wish to profile, and find results in |
6 | 1 | Alex V Koval | /tmp or into settings.PROFILE_LOG_BASE |
7 | |||
8 | |||
9 | 3 | Alex V Koval | h3. To view, you will need to install following packages: |
10 | 1 | Alex V Koval | |
11 | * media-gfx/graphviz |
||
12 | 4 | Alex V Koval | * dev-util/gprof2dot (save it from http://gprof2dot.jrfonseca.googlecode.com/git/gprof2dot.py) |
13 | 3 | Alex V Koval | |
14 | h3. Generate PNG: |
||
15 | |||
16 | 5 | Alex V Koval | gprof2dot.py -f pstats ~/yp/default/djyp/stones1.prof | dot -Tpng -o output.png |
17 | 3 | Alex V Koval | |
18 | for a convinience I've made a shell script for myself. |