Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes | Private Attributes
MoinMoin.web.profile.HotshotMiddleware Class Reference
Inheritance diagram for MoinMoin.web.profile.HotshotMiddleware:
Inheritance graph
[legend]
Collaboration diagram for MoinMoin.web.profile.HotshotMiddleware:
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

Detailed Description

A profiler based on the more recent hotshot module from the stdlib. 

Definition at line 77 of file profile.py.


Constructor & Destructor Documentation

def MoinMoin.web.profile.HotshotMiddleware.__init__ (   self,
  app,
  args,
  kwargs 
)

Definition at line 79 of file profile.py.

00079 
00080     def __init__(self, app, *args, **kwargs):
00081         super(HotshotMiddleware, self).__init__(app)
00082         import hotshot
00083         self._profile = hotshot.Profile(*args, **kwargs)
00084         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 85 of file profile.py.

00085 
00086     def shutdown(self):
00087         self._profile.close()

Here is the caller graph for this function:


Member Data Documentation

Definition at line 82 of file profile.py.

Definition at line 34 of file profile.py.

Definition at line 83 of file profile.py.


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