Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes | Private Attributes
MoinMoin.web.profile.CProfileMiddleware Class Reference
Inheritance diagram for MoinMoin.web.profile.CProfileMiddleware:
Inheritance graph
[legend]
Collaboration diagram for MoinMoin.web.profile.CProfileMiddleware:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def shutdown
def profile
def run_profile

Public Attributes

 run_profile
 app

Private Attributes

 _profile
 _filename

Detailed Description

A profiler based on the the cProfile module from the standard lib. 

Definition at line 65 of file profile.py.


Constructor & Destructor Documentation

def MoinMoin.web.profile.CProfileMiddleware.__init__ (   self,
  app,
  filename 
)

Definition at line 67 of file profile.py.

00067 
00068     def __init__(self, app, filename):
00069         super(CProfileMiddleware, self).__init__(app)
00070         import cProfile
00071         self._profile = cProfile.Profile()
00072         self._filename = filename
00073         self.run_profile = self._profile.runcall


Member Function Documentation

def MoinMoin.web.profile.ProfilerMiddleware.profile (   self,
  environ,
  start_response 
) [inherited]
Profile the request. Exceptions encountered during the profile are
logged before being propagated for further handling.

Definition at line 36 of file profile.py.

00036 
00037     def profile(self, environ, start_response):
00038         """
00039         Profile the request. Exceptions encountered during the profile are
00040         logged before being propagated for further handling.
00041         """
00042         method = environ.get('REQUEST_METHOD', 'GET')
00043         url = get_current_url(environ)
00044         logging.debug("Profiling call for '%s %s'", method, url)
00045         try:
00046             res = self.run_profile(self.app, (environ, start_response))
00047         except Exception, e:
00048             logging.exception("Exception while profiling '%s %s'", method, url)
00049             raise
00050         return res

Here is the call graph for this function:

def MoinMoin.web.profile.ProfilerMiddleware.run_profile (   self,
  app,
  args,
  kwargs 
) [inherited]
Override in subclasses.

Several profilers available for python use the same call signature,
therefore simplifying the implementation.

Reimplemented in MoinMoin.web.profile.PycallgraphMiddleware.

Definition at line 53 of file profile.py.

00053 
00054     def run_profile(self, app, *args, **kwargs):
00055         """ Override in subclasses.
00056 
00057         Several profilers available for python use the same call signature,
00058         therefore simplifying the implementation.
00059         """
00060         raise NotImplementedError()

Here is the caller graph for this function:

Override in subclasses to clean up when server/script shuts down. 

Reimplemented from MoinMoin.web.profile.ProfilerMiddleware.

Definition at line 74 of file profile.py.

00074 
00075     def shutdown(self):
00076         self._profile.dump_stats(self._filename)

Here is the caller graph for this function:


Member Data Documentation

Definition at line 71 of file profile.py.

Definition at line 70 of file profile.py.

Definition at line 34 of file profile.py.

Definition at line 72 of file profile.py.


The documentation for this class was generated from the following file: