pycallgraph

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
import time
import pycallgraph
from django.conf import settings

class CallgraphMiddleware(object):
    def process_view(self, request, callback, callback_args, callback_kwargs):
        if settings.DEBUG and 'graph' in request.GET:
            filter_func = pycallgraph.GlobbingFilter(include=['myapp.*'],
                    exclude=['myapp.debug.*'])
            pycallgraph.start_trace(filter_func=filter_func)

    def process_response(self, request, response):
        if settings.DEBUG and 'graph' in request.GET:
            pycallgraph.make_dot_graph('callgraph-' + str(time.time()) + '.png')
        return response

More like this

  1. SSL Middleware for Webfaction by parlar 6 years ago
  2. Profiling Middlware by udfalkso 6 years, 1 month ago
  3. SQLLoggerMidleware + infobar by robvdl 5 years, 4 months ago
  4. dynamic model graph by findlay 5 years ago
  5. Mobilize your Django site by stevena0 4 years, 1 month ago

Comments

(Forgotten your password?)