[Zodb-checkins] CVS: ZODB3/ZEO - stats.py:1.21.20.2
Jeremy Hylton
cvs-admin at zope.org
Wed Nov 19 15:27:26 EST 2003
Update of /cvs-repository/ZODB3/ZEO
In directory cvs.zope.org:/tmp/cvs-serv12347/ZEO
Modified Files:
Tag: ZODB3-mvcc-2-branch
stats.py
Log Message:
Add some comments about what variables are for.
Repair some of the code to work with the MVCC cache trace.
=== ZODB3/ZEO/stats.py 1.21.20.1 => 1.21.20.2 ===
--- ZODB3/ZEO/stats.py:1.21.20.1 Wed Nov 19 13:38:48 2003
+++ ZODB3/ZEO/stats.py Wed Nov 19 15:27:25 2003
@@ -128,15 +128,21 @@
# Read file, gathering statistics, and printing each record if verbose
rt0 = time.time()
+ # bycode -- map code to count of occurrences
bycode = {}
+ # records -- number of records
records = 0
+ # version -- number of records with versions
versions = 0
t0 = te = None
+ # datarecords -- number of records with dlen set
datarecords = 0
datasize = 0L
- file0 = file1 = 0
+ # oids -- maps oid to number of times it was loaded
oids = {}
+ # bysize -- maps data size to number of loads
bysize = {}
+ # bysize -- maps data size to number of writes
bysizew = {}
total_loads = 0
byinterval = {}
@@ -187,11 +193,6 @@
if code & 0x80:
version = 'V'
versions += 1
- current = code & 1
- if current:
- file1 += 1
- else:
- file0 += 1
code = code & 0x7e
bycode[code] = bycode.get(code, 0) + 1
byinterval[code] = byinterval.get(code, 0) + 1
@@ -199,7 +200,7 @@
if code & 0x70 == 0x20: # All loads
bysize[dlen] = d = bysize.get(dlen) or {}
d[oid] = d.get(oid, 0) + 1
- elif code == 0x3A: # Update
+ elif code & 0x70 == 0x50: # All stores
bysizew[dlen] = d = bysizew.get(dlen) or {}
d[oid] = d.get(oid, 0) + 1
if verbose:
@@ -249,8 +250,6 @@
print "First time: %s" % time.ctime(t0)
print "Last time: %s" % time.ctime(te)
print "Duration: %s seconds" % addcommas(te-t0)
- print "File stats: %s in file 0; %s in file 1" % (
- addcommas(file0), addcommas(file1))
print "Data recs: %s (%.1f%%), average size %.1f KB" % (
addcommas(datarecords),
100.0 * datarecords / records,
@@ -334,7 +333,7 @@
if code & 0x70 == 0x20:
n = bycode[code]
loads += n
- if code in (0x2A, 0x2C, 0x2E):
+ if code in (0x22, 0x26):
hits += n
if loads:
return 100.0 * hits / loads
More information about the Zodb-checkins
mailing list