[Zope-Checkins] CVS: Zope/lib/python/Products/CallProfiler - CallProfiler.py:1.1.2.3 utilities.py:1.1.2.2
Anthony Baxter
anthony@interlink.com.au
Mon, 20 May 2002 03:29:58 -0400
Update of /cvs-repository/Zope/lib/python/Products/CallProfiler
In directory cvs.zope.org:/tmp/cvs-serv6632
Modified Files:
Tag: anthony-CallProfiler-branch
CallProfiler.py utilities.py
Log Message:
removed some now-dead code from CallProfiler.py. hooks have been moved to
utilities.py
refresh is still there.
=== Zope/lib/python/Products/CallProfiler/CallProfiler.py 1.1.2.2 => 1.1.2.3 ===
from utilities import *
-def profiler_call_hook(self, *args, **kw):
- '''A call hook
- '''
- mt = self.meta_type
- sid = self.getId()
- profiler.startCall(mt, sid)
- try:
- return self.profiler_call_original(*args, **kw)
- finally:
- profiler.endCall()
-
-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
- import sys
- LOG('CallProfiler.publish_hook', ERROR,
- 'Error during endmark()', error=sys.exc_info())
-
-default_marker = []
-def profiler_cache_hook(self, view_name='', keywords=None, mtime_func=None,
- default=default_marker):
- '''A cache hook
- '''
- import OFS.Cache
- ret = self.profiler_cache_original(view_name, keywords,
- mtime_func, default)
- if ret is default:
- profiler.cacheMiss()
- else:
- profiler.cacheHit()
- return ret
-
class Profileable:
@@ -540,6 +495,12 @@
#
# $Log$
+# Revision 1.1.2.3 2002/05/20 07:29:57 anthony
+# removed some now-dead code from CallProfiler.py. hooks have been moved to
+# utilities.py
+#
+# refresh is still there.
+#
# Revision 1.1.2.2 2002/05/20 07:21:36 anthony
# First commit of merged ZC changes (from Ken, Tres and Shane (according to
# the rcs dollarLogdollar))
=== Zope/lib/python/Products/CallProfiler/utilities.py 1.1.2.1 => 1.1.2.2 ===
from profiler import profiler
from MethodWrapper import MethodWrapper
+from zLOG import LOG, ERROR, INFO
+import sys
def profiler_publish_hook(request, *args, **kw):
"""Instrument publisher for CallProfiler profiling."""
@@ -18,7 +20,6 @@
profiler.endRequest()
except:
# log the error though
- import sys
LOG('CallProfiler.publish_hook', ERROR,
'Error during endmark()', error=sys.exc_info())