def __call__(self, environ, start_response): response_body = [] def catching_start_response(status, headers): start_response(status, headers) return response_body.append def runapp(): appiter = self.app(environ, catching_start_response) response_body.extend(appiter) if hasattr(appiter, 'close'): appiter.close() gevent_profiler.profile(runapp) body = ''.join(response_body) return [body]
def gevent_profiler__prof_call(func, *args): import gevent_profiler return gevent_profiler.profile(func, *args)
def runner(result): gevent_profiler.profile(test, result)