def __call__(self, environ, start_response):
        self.reqnum += 1
        if not self.should_run(environ):
            return self.application(environ, start_response)

        profile = cProfile.Profile()

        start = time.time()
        try:
            return list(profile.runcall(self.application, environ, start_response))
        finally:
            stop = time.time()
            try:
                if (stop - start) > self.threshold:
                    self.report_result(profile, environ, start, stop, self.outpath)
            except Exception, e:
                self.logger.exception(e)
dataset/ETHPy150Open disqus/django-perftools/perftools/middleware/remoteprof.py/RemoteProfilingMiddleware.__call__/original