[Checkins] SVN: zc.z3monitor/branches/dev/src/zc/z3monitor/ Added
cache info to dbinfo output.
Jim Fulton
jim at zope.com
Sun May 6 15:47:42 EDT 2007
Log message for revision 75580:
Added cache info to dbinfo output.
Changed:
U zc.z3monitor/branches/dev/src/zc/z3monitor/README.txt
U zc.z3monitor/branches/dev/src/zc/z3monitor/__init__.py
-=-
Modified: zc.z3monitor/branches/dev/src/zc/z3monitor/README.txt
===================================================================
--- zc.z3monitor/branches/dev/src/zc/z3monitor/README.txt 2007-05-06 18:12:36 UTC (rev 75579)
+++ zc.z3monitor/branches/dev/src/zc/z3monitor/README.txt 2007-05-06 19:47:41 UTC (rev 75580)
@@ -83,7 +83,7 @@
by a database name:
>>> connection.test_input('dbinfo\n')
- 0 0 2
+ 0 0 2 0 0
-> CLOSE
Let's open a connection and do some work:
@@ -97,10 +97,10 @@
>>> conn.close()
>>> connection.test_input('dbinfo\n')
- 1 2 3
+ 1 2 3 1 1
-> CLOSE
-The dbinfo command returns 3 values:
+The dbinfo command returns 5 values:
- number of database loads
@@ -108,29 +108,33 @@
- number of connections in the last five minutes
+- number of objects in the object caches (combined)
+
+- number of non-ghost objects in the object caches (combined)
+
You can specify a database name. So, to get statistics for the other
database, we'll specify the name it was registered with:
>>> connection.test_input('dbinfo other\n')
- 0 0 0
+ 0 0 0 0 0
-> CLOSE
You can use '-' to name the main database:
>>> connection.test_input('dbinfo -\n')
- 1 2 3
+ 1 2 3 1 1
-> CLOSE
You can specify a number of seconds to sample. For example, to get
data for the last 10 seconds:
>>> connection.test_input('dbinfo - 10\n')
- 1 2 3
+ 1 2 3 1 1
-> CLOSE
.. Edge case to make sure that deltat is used:
>>> connection.test_input('dbinfo - 0\n')
- 0 0 0
+ 0 0 0 1 1
-> CLOSE
Modified: zc.z3monitor/branches/dev/src/zc/z3monitor/__init__.py
===================================================================
--- zc.z3monitor/branches/dev/src/zc/z3monitor/__init__.py 2007-05-06 18:12:36 UTC (rev 75579)
+++ zc.z3monitor/branches/dev/src/zc/z3monitor/__init__.py 2007-05-06 19:47:41 UTC (rev 75580)
@@ -105,9 +105,15 @@
analysis['stores'],
analysis['connections'],
)
- print >> connection, data[0], data[1], data[2]
+ ng = s = 0
+ for detail in db.cacheDetailSize():
+ ng += detail['ngsize']
+ s += detail['size']
+
+ print >> connection, data[0], data[1], data[2], s, ng
+
@zope.component.adapter(zope.app.appsetup.interfaces.IDatabaseOpenedEvent)
def initialize(opened_event):
for name, db in zope.component.getUtilitiesFor(ZODB.interfaces.IDatabase):
@@ -142,6 +148,8 @@
pid = os.getpid()
def getStatus(want=('VmSize', 'VmRSS')):
+ if not os.path.exists('/proc/%s/status' % pid):
+ return
for line in open('/proc/%s/status' % pid):
if (line.split(':')[0] in want):
yield line.strip()
More information about the Checkins
mailing list