def testMark(self):
     request = DummyRequest()
     profiler.startRequest(request)
     profiler.startCall('foo', 'bar')
     profiler.startCall('foo', 'flebb')
     profiler.endCall()
     profiler.endCall()
     profiler.endRequest()
     self.assertEqual(len(profiler.transaction), 1)
     request, = profiler.transaction.values()
 def testMark(self):
     request = DummyRequest()
     profiler.startRequest(request)
     profiler.startCall('foo', 'bar')
     profiler.startCall('foo', 'flebb')
     profiler.endCall()
     profiler.endCall()
     profiler.endRequest()
     self.assertEqual(len(profiler.transaction), 1)
     request, = profiler.transaction.values()
def profiler_publish_hook(request, *args, **kw):
    '''Publisher hook
    '''
    profiler.startRequest(request)
    import ZPublisher.Publish
    try:
        return ZPublisher.Publish.profiler_publish_original(request, *args, **kw)  # noqa
    finally:
        # if we die here, we want to catch it or the publisher will get
        # confused...
        try:
            profiler.endRequest()
        except:
            # log the error though
            from zLOG import LOG, ERROR
            import sys
            LOG('CallProfiler.publish_hook', ERROR,
                'Error during endmark()', error=sys.exc_info())
def profiler_publish_hook(request, *args, **kw):
    '''Publisher hook
    '''
    profiler.startRequest(request)
    import ZPublisher.Publish
    try:
        return ZPublisher.Publish.profiler_publish_original(
            request, *args, **kw)
    finally:
        # if we die here, we want to catch it or the publisher will get
        # confused...
        try:
            profiler.endRequest()
        except:
            # log the error though
            from zLOG import LOG, ERROR
            import sys
            LOG('CallProfiler.publish_hook',
                ERROR,
                'Error during endmark()',
                error=sys.exc_info())