[Zodb-checkins] CVS: ZODB3/ZEO - monitor.py:1.3

Jeremy Hylton jeremy@zope.com
Wed, 15 Jan 2003 16:23:49 -0500


Update of /cvs-repository/ZODB3/ZEO
In directory cvs.zope.org:/tmp/cvs-serv19784/ZEO

Modified Files:
	monitor.py 
Log Message:
Extend the monitor test suite to actually parse the monitor output.


=== ZODB3/ZEO/monitor.py 1.2 => 1.3 ===
--- ZODB3/ZEO/monitor.py:1.2	Thu Jan  9 18:55:57 2003
+++ ZODB3/ZEO/monitor.py	Wed Jan 15 16:23:16 2003
@@ -40,6 +40,35 @@
         self.conflicts_resolved = 0
         self.start = time.ctime()
 
+    def parse(self, s):
+        # parse the dump format
+        lines = s.split("\n")
+        for line in lines:
+            field, value = line.split(":", 1)
+            if field == "Server started":
+                self.start = value
+            elif field == "Clients":
+                self.clients = int(value)
+            elif field == "Clients verifying":
+                self.verifying_clients = int(value)
+            elif field == "Active transactions":
+                self.active_txns = int(value)
+            elif field == "Commit lock held for":
+                # This assumes 
+                self.lock_time = time.time() - int(value)
+            elif field == "Commits":
+                self.commits = int(value)
+            elif field == "Aborts":
+                self.aborts = int(value)
+            elif field == "Loads":
+                self.loads = int(value)
+            elif field == "Stores":
+                self.stores = int(value)
+            elif field == "Conflicts":
+                self.conflicts = int(value)
+            elif field == "Conflicts resolved":
+                self.conflicts_resolved = int(value)
+
     def dump(self, f):
         print >> f, "Server started:", self.start
         print >> f, "Clients:", self.clients