[Zodb-checkins] CVS: StandaloneZODB/ZEO - StorageServer.py:1.34.2.5

Jeremy Hylton jeremy@zope.com
Fri, 15 Mar 2002 02:50:01 -0500


Update of /cvs-repository/StandaloneZODB/ZEO
In directory cvs.zope.org:/tmp/cvs-serv1307

Modified Files:
      Tag: zeo-1_0-debug-branch
	StorageServer.py 
Log Message:
Add number of calls made to stats.


=== StandaloneZODB/ZEO/StorageServer.py 1.34.2.4 => 1.34.2.5 ===
             self._t_begin = None
             self._t_end = None
+            self._ncalls = 0
             
         SizedMessageAsyncConnection.__init__(self, sock, addr, debug=debug)
         log.info('Connect %s %s' % (id(self), `addr`))
@@ -201,13 +202,15 @@
         # can always get detailed statistics about other connections.
         if __debug__:
             if self._last_method == "status":
-                return "method=status begin=%s end=..." % self._t_begin
+                return "method=status begin=%s end=... ncalls=%d" % (
+                    self._t_begin, self._ncalls)
             if self._t_end is not None and self._t_begin is not None:
                 delta = self._t_end - self._t_begin
             else:
                 delta = -1
-            return "method=%s begin=%s end=%s delta=%.3f" % (
-                self._last_method, self._t_begin, self._t_end, delta)
+            return "method=%s begin=%s end=%s delta=%.3f ncalls=%d" % (
+                self._last_method, self._t_begin, self._t_end, delta,
+                self._ncalls)
         else:
             return ""
 
@@ -267,6 +270,7 @@
             name, args = args[0], args[1:]
             if __debug__:
                 self._last_method = name
+                self._ncalls = self._ncalls + 1
                 log.debug("call %s%s from %s" % (name, format_msg(args),
                                                  self.addr))