[Checkins] SVN: zc.z3monitor/trunk/s Added a command to get ZEO cache statistics.

Jim Fulton jim at zope.com
Thu Nov 15 15:33:49 EST 2007


Log message for revision 81856:
  Added a command to get ZEO cache statistics.
  

Changed:
  U   zc.z3monitor/trunk/setup.py
  A   zc.z3monitor/trunk/src/zc/z3monitor/CHANGES.txt
  U   zc.z3monitor/trunk/src/zc/z3monitor/README.txt
  U   zc.z3monitor/trunk/src/zc/z3monitor/__init__.py
  U   zc.z3monitor/trunk/src/zc/z3monitor/tests.py

-=-
Modified: zc.z3monitor/trunk/setup.py
===================================================================
--- zc.z3monitor/trunk/setup.py	2007-11-15 20:33:45 UTC (rev 81855)
+++ zc.z3monitor/trunk/setup.py	2007-11-15 20:33:49 UTC (rev 81856)
@@ -3,7 +3,7 @@
 name = 'zc.z3monitor'
 setup(
     name = name,
-    version = '0.1.1b2',
+    version = '0.2.0',
     author = 'Jim Fulton',
     author_email = 'jim at zope.com',
     description = 'Zope 3 Monitor',
@@ -13,7 +13,10 @@
     packages = find_packages('src'),
     namespace_packages = ['zc'],
     package_dir = {'': 'src'},
-    install_requires = ['setuptools', 'zc.ngi'],
+    install_requires = [
+        'setuptools', 'zc.ngi', 'ZODB3', 'zope.component',
+        'zope.publisher',
+        ],
     include_package_data = True,
     zip_safe = False,
     )

Added: zc.z3monitor/trunk/src/zc/z3monitor/CHANGES.txt
===================================================================
--- zc.z3monitor/trunk/src/zc/z3monitor/CHANGES.txt	                        (rev 0)
+++ zc.z3monitor/trunk/src/zc/z3monitor/CHANGES.txt	2007-11-15 20:33:49 UTC (rev 81856)
@@ -0,0 +1,10 @@
+Change History
+**************
+
+0.2.0 (2007-11-15)
+==================
+
+New Features
+------------
+
+Added a command to get ZEO cache statistics.


Property changes on: zc.z3monitor/trunk/src/zc/z3monitor/CHANGES.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: zc.z3monitor/trunk/src/zc/z3monitor/README.txt
===================================================================
--- zc.z3monitor/trunk/src/zc/z3monitor/README.txt	2007-11-15 20:33:45 UTC (rev 81855)
+++ zc.z3monitor/trunk/src/zc/z3monitor/README.txt	2007-11-15 20:33:49 UTC (rev 81856)
@@ -29,6 +29,9 @@
     >>> main.setActivityMonitor(ZODB.ActivityMonitor.ActivityMonitor())
     >>> other.setActivityMonitor(ZODB.ActivityMonitor.ActivityMonitor())
 
+Process Information
+-------------------
+
 To get information about the process overall, use the monitor
 command:
 
@@ -79,6 +82,9 @@
     >>> conn1.close()
     >>> conn2.close()
 
+Database Information
+--------------------
+
 To get information about a database, give the dbinfo command followed
 by a database name:
 
@@ -137,3 +143,28 @@
     >>> connection.test_input('dbinfo - 0\n')
     0   0   0   1   1 
     -> CLOSE
+
+ZEO cache statistics
+--------------------
+
+You can also get ZEO cache statistics using the zeocache command.
+
+    >>> connection.test_input('zeocache\n')
+    42 4200 23 2300 1000 
+    -> CLOSE
+
+The output statistics are:
+
+- the number of records added to the cache,
+
+- the number of bytes added to the cache,
+
+- the number of records evicted from the cache,
+
+- the number of bytes evictes from the cache,
+
+You can also specify a database name:
+
+    >>> connection.test_input('zeocache other\n')
+    42 4200 23 2300 1000 
+    -> CLOSE

Modified: zc.z3monitor/trunk/src/zc/z3monitor/__init__.py
===================================================================
--- zc.z3monitor/trunk/src/zc/z3monitor/__init__.py	2007-11-15 20:33:45 UTC (rev 81855)
+++ zc.z3monitor/trunk/src/zc/z3monitor/__init__.py	2007-11-15 20:33:49 UTC (rev 81856)
@@ -120,7 +120,13 @@
 
         print >> connection, data[0], data[1], data[2], s, ng
 
+    def command_zeocache(self, connection, database=''):
+        db = zope.component.getUtility(ZODB.interfaces.IDatabase, database)
+        stats = db._storage._cache.getStats()
+        print >> connection, ' '.join(map(str, stats))
+        
 
+
 @zope.component.adapter(zope.app.appsetup.interfaces.IDatabaseOpenedEvent)
 def initialize(opened_event):
     config = zope.app.appsetup.product.getProductConfiguration(__name__)

Modified: zc.z3monitor/trunk/src/zc/z3monitor/tests.py
===================================================================
--- zc.z3monitor/trunk/src/zc/z3monitor/tests.py	2007-11-15 20:33:45 UTC (rev 81855)
+++ zc.z3monitor/trunk/src/zc/z3monitor/tests.py	2007-11-15 20:33:49 UTC (rev 81856)
@@ -12,11 +12,19 @@
 #
 ##############################################################################
 import re, unittest
+import logging, sys
+
+import ZODB.MappingStorage
+
 from zope.testing import doctest, renormalizing
 
-import logging, sys
+class FauxCache:
 
+    def getStats(self):
+        return 42, 4200, 23, 2300, 1000
 
+ZODB.MappingStorage.MappingStorage._cache = FauxCache()
+
 def test_suite():
     return unittest.TestSuite((
         doctest.DocFileSuite(



More information about the Checkins mailing list