[Checkins] SVN: zc.zeoinputlog/branches/replay/src/zc/zeoinputlog/replay.py *** empty log message ***

Jim Fulton jim at zope.com
Sun Oct 4 11:59:54 EDT 2009


Log message for revision 104777:
  *** empty log message ***

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	2009-10-04 15:36:40 UTC (rev 104776)
+++ zc.zeoinputlog/branches/replay/src/zc/zeoinputlog/replay.py	2009-10-04 15:59:54 UTC (rev 104777)
@@ -189,8 +189,27 @@
             stats['ops'][op] = stats['ops'].get(op, 0) + 1
             stats['size'] += 1
 
-        return sorted(sessions.itervalues(), key=lambda v: v['start_timetime'])
+        return sessions
 
+    def splitsessions(self, sessions, outname):
+        # Split the given sessions my splitting roughly half the calls
+        # calls into a new session containing only loadEx calls
+        sessions = set("0%s" % session for session in sessions)
+        sizes = {}
+        out = open(outname, 'wb')
+        for session, timetime, msgid, async, op, args in self:
+            session = "0%s" % session
+            if (session in sessions
+                and op == 'loadEx'
+                and sizes.get(session, 0) > sizes.get('1'+session[1:], 0)
+                ):
+                session = '1'+session[1:]
+            sizes[session] = sizes.get(session, 0) + 1
+            marshal.dump(
+                (session, timetime, cPickle.dumps((msgid, async, op, args), 1)
+                 ),
+                out)
+
 class Transactions(object):
 
 



More information about the checkins mailing list