annotate MoinMoin/web/profile.py @ 6076:f4ec84967c27

add colon to make log_attempt even more parseable
author 'Karl O. Pinc' <kop@meme.com>
date Mon, 15 Sep 2014 22:10:45 -0500
parents d8e5e9cfadf1
children
rev   line source
4264
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
1 # -*- coding: iso-8859-1 -*-
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
2 """
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
3 MoinMoin - WSGI middlewares for profiling
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
4
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
5 These have been ported from server_standalone to provide application
4320
9f41f41891aa Code review: update doc strings, elaborate on use and TODO
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4313
diff changeset
6 profiling for a WSGI application. They are implemented as WSGI
9f41f41891aa Code review: update doc strings, elaborate on use and TODO
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4313
diff changeset
7 middlewares, so they can be plugged right in front of the MoinMoin
9f41f41891aa Code review: update doc strings, elaborate on use and TODO
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4313
diff changeset
8 WSGI application. Attention has to be payed, that at the end of
9f41f41891aa Code review: update doc strings, elaborate on use and TODO
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4313
diff changeset
9 profiling the `shutdown`-method has to be invoked, so that the
9f41f41891aa Code review: update doc strings, elaborate on use and TODO
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4313
diff changeset
10 middlewares can write the reports to the filesystem.
4313
0ab9e5a38822 Code review: added doc strings, log exceptions
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4264
diff changeset
11
4320
9f41f41891aa Code review: update doc strings, elaborate on use and TODO
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4313
diff changeset
12 TODO: in pre-WSGI MoinMoin those profilers where integrated in
9f41f41891aa Code review: update doc strings, elaborate on use and TODO
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4313
diff changeset
13 the standalone server and also some other gateway interfaces.
9f41f41891aa Code review: update doc strings, elaborate on use and TODO
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4313
diff changeset
14 In the near future the middlewares here could be again made
9f41f41891aa Code review: update doc strings, elaborate on use and TODO
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4313
diff changeset
15 configurable automatically with command line switches or
9f41f41891aa Code review: update doc strings, elaborate on use and TODO
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4313
diff changeset
16 wiki configuration options.
4264
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
17
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
18 @copyright: 2008 MoinMoin:FlorianKrupicka,
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
19 @license: GNU GPL, see COPYING for details.
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
20 """
4607
d8e5e9cfadf1 always do 'from werkzeug import ...', except for contrib, exceptions, routing, script
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4320
diff changeset
21 from werkzeug import get_current_url
4264
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
22
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
23 from MoinMoin import log
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
24 logging = log.getLogger(__name__)
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
25
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
26 class ProfilerMiddleware(object):
4313
0ab9e5a38822 Code review: added doc strings, log exceptions
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4264
diff changeset
27 """ Abstract base class for profiling middlewares.
0ab9e5a38822 Code review: added doc strings, log exceptions
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4264
diff changeset
28
0ab9e5a38822 Code review: added doc strings, log exceptions
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4264
diff changeset
29 Concrete implementations of this class should provide implementations
0ab9e5a38822 Code review: added doc strings, log exceptions
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4264
diff changeset
30 of `run_profile` and `shutdown`, the latter which should be called by
0ab9e5a38822 Code review: added doc strings, log exceptions
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4264
diff changeset
31 the code utilizing the profiler.
0ab9e5a38822 Code review: added doc strings, log exceptions
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4264
diff changeset
32 """
4264
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
33 def __init__(self, app):
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
34 self.app = app
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
35
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
36 def profile(self, environ, start_response):
4313
0ab9e5a38822 Code review: added doc strings, log exceptions
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4264
diff changeset
37 """
0ab9e5a38822 Code review: added doc strings, log exceptions
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4264
diff changeset
38 Profile the request. Exceptions encountered during the profile are
0ab9e5a38822 Code review: added doc strings, log exceptions
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4264
diff changeset
39 logged before being propagated for further handling.
0ab9e5a38822 Code review: added doc strings, log exceptions
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4264
diff changeset
40 """
4264
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
41 method = environ.get('REQUEST_METHOD', 'GET')
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
42 url = get_current_url(environ)
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
43 logging.debug("Profiling call for '%s %s'", method, url)
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
44 try:
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
45 res = self.run_profile(self.app, (environ, start_response))
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
46 except Exception, e:
4313
0ab9e5a38822 Code review: added doc strings, log exceptions
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4264
diff changeset
47 logging.exception("Exception while profiling '%s %s'", method, url)
4264
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
48 raise
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
49 return res
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
50
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
51 __call__ = profile
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
52
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
53 def run_profile(self, app, *args, **kwargs):
4313
0ab9e5a38822 Code review: added doc strings, log exceptions
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4264
diff changeset
54 """ Override in subclasses.
0ab9e5a38822 Code review: added doc strings, log exceptions
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4264
diff changeset
55
0ab9e5a38822 Code review: added doc strings, log exceptions
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4264
diff changeset
56 Several profilers available for python use the same call signature,
0ab9e5a38822 Code review: added doc strings, log exceptions
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4264
diff changeset
57 therefore simplifying the implementation.
4264
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
58 """
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
59 raise NotImplementedError()
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
60
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
61 def shutdown(self):
4313
0ab9e5a38822 Code review: added doc strings, log exceptions
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4264
diff changeset
62 """ Override in subclasses to clean up when server/script shuts down. """
4264
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
63 pass
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
64
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
65 class CProfileMiddleware(ProfilerMiddleware):
4313
0ab9e5a38822 Code review: added doc strings, log exceptions
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4264
diff changeset
66 """ A profiler based on the the cProfile module from the standard lib. """
4264
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
67 def __init__(self, app, filename):
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
68 super(CProfileMiddleware, self).__init__(app)
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
69 import cProfile
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
70 self._profile = cProfile.Profile()
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
71 self._filename = filename
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
72 self.run_profile = self._profile.runcall
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
73
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
74 def shutdown(self):
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
75 self._profile.dump_stats(self._filename)
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
76
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
77 class HotshotMiddleware(ProfilerMiddleware):
4313
0ab9e5a38822 Code review: added doc strings, log exceptions
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4264
diff changeset
78 """ A profiler based on the more recent hotshot module from the stdlib. """
4264
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
79 def __init__(self, app, *args, **kwargs):
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
80 super(HotshotMiddleware, self).__init__(app)
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
81 import hotshot
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
82 self._profile = hotshot.Profile(*args, **kwargs)
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
83 self.run_profile = self._profile.runcall
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
84
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
85 def shutdown(self):
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
86 self._profile.close()
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
87
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
88 class PycallgraphMiddleware(ProfilerMiddleware):
4313
0ab9e5a38822 Code review: added doc strings, log exceptions
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4264
diff changeset
89 """ A call graphing middleware utilizing the pycallgraph 3rd party
0ab9e5a38822 Code review: added doc strings, log exceptions
Florian Krupicka <florian.krupicka@googlemail.com>
parents: 4264
diff changeset
90 module (available at http://pycallgraph.slowchop.com/). """
4264
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
91 def __init__(self, app, filename):
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
92 super(PycallgraphMiddleware, self).__init__(app)
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
93 import pycallgraph
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
94 pycallgraph.settings['include_stdlib'] = False
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
95 self._filename = filename
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
96 globs = ['pycallgraph.*', 'unknown.*']
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
97 f = pycallgraph.GlobbingFilter(exclude=globs, max_depth=9999)
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
98 self._filter = f
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
99 self.pycallgraph = pycallgraph
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
100
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
101 def run_profile(self, app, *args, **kwargs):
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
102 pycallgraph = self.pycallgraph
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
103 pycallgraph.start_trace(reset=True, filter_func=self._filter)
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
104 try:
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
105 return app(*args, **kwargs)
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
106 finally:
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
107 pycallgraph.stop_trace()
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
108
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
109 def shutdown(self):
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
110 fname = self._filename
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
111 pycallgraph = self.pycallgraph
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
112 if fname.endswith('.png'):
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
113 logging.info("Saving the rendered callgraph to '%s'", fname)
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
114 pycallgraph.make_dot_graph(fname)
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
115 elif fname.endswith('.dot'):
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
116 logging.info("Saving the raw callgraph to '%s'", fname)
fa648504e1cf Add profile/callgraph functionality from MoinMoin.server.server_standalone as WSGI middlewares
Florian Krupicka <florian.krupicka@googlemail.com>
parents:
diff changeset
117 pycallgraph.save_dot(fname)