[Checkins] SVN: zc.zeoinputlog/branches/replay/src/zc/zeoinputlog/replay.py Checking in various tweeks from way back. They must have been good. :)

Jim Fulton jim at zope.com
Thu Mar 3 09:25:53 EST 2011


Log message for revision 120737:
  Checking in various tweeks from way back. They must have been good. :)
  

Changed:
  U   zc.zeoinputlog/branches/replay/src/zc/zeoinputlog/replay.py

-=-
Modified: zc.zeoinputlog/branches/replay/src/zc/zeoinputlog/replay.py
===================================================================
--- zc.zeoinputlog/branches/replay/src/zc/zeoinputlog/replay.py	2011-03-03 14:25:33 UTC (rev 120736)
+++ zc.zeoinputlog/branches/replay/src/zc/zeoinputlog/replay.py	2011-03-03 14:25:53 UTC (rev 120737)
@@ -377,18 +377,18 @@
 
 class Handlers:
 
-    async = abandoned = 0
+    async = abandoned = active = 0
 
     def __init__(self, disconnected):
         self.errtimes = {}
         self.times = {}
         self.disconnected = disconnected
-        self.connected = self.active = self.calls = self.replies = 0
+        self.connected = self.maxactive = self.calls = self.replies = 0
         self.errors = 0
         self.event = threading.Event()
 
     def __repr__(self):
-        return ("%(connected)s %(disconnected)s %(active)s"
+        return ("%(connected)s %(disconnected)s %(maxactive)s"
                 " %(calls)s %(replies)s %(errors)s"
                 % self.__dict__)
 
@@ -412,6 +412,7 @@
 
     def request(self, op, args):
         self.active += 1
+        self.maxactive = max(self.maxactive, self.active)
         self.calls += 1
 
     def reply(self, op, args, ret, elapsed):
@@ -471,7 +472,14 @@
 
     print "$Id$"
     print args
-    [addr, log, source] = args[:3]
+    addr = args.pop(0)
+    log = args.pop(0)
+    source = args.pop(0)
+    if args:
+        maxtrans = int(args.pop(0))
+    else:
+        maxtrans = 999999999
+    assert not args
     addr = parse_addr(addr)
 
     log = Log(log)
@@ -535,6 +543,7 @@
         print nt, time.strftime('%H:%M:%S', time.localtime(time.time())),
         print ZODB.TimeStamp.TimeStamp(time_stamp(tt)), handlers,
         print speed, speed1
+        handlers.maxactive = 0
         while logrecord[1] < tt:
             ni += 1
             session, _, _, async, op, args = logrecord
@@ -560,6 +569,9 @@
         #print '=== finish'
         cs.tpc_finish(t)
 
+        if nt >= maxtrans:
+            break
+
     print '='*70
 
     print speed, nt, nt*3+nr, ni



More information about the checkins mailing list