[Zodb-checkins] CVS: ZODB3/ZEO - ClientCache.py:1.30.2.2
Guido van Rossum
guido@python.org
Wed, 28 Aug 2002 17:23:48 -0400
Update of /cvs-repository/ZODB3/ZEO
In directory cvs.zope.org:/tmp/cvs-serv24377
Modified Files:
Tag: zeo_trace_branch
ClientCache.py
Log Message:
Improvements to the tracing (this is still in a branch, don't worry).
Add the current file to the trace file.
Trace store events.
Trace flip events.
Show the serial before the data size so the serial column appears
aligned (unless there are versions). Therefore, swap the serial and
data arguments.
Don't require the oid argument.
=== ZODB3/ZEO/ClientCache.py 1.30.2.1 => 1.30.2.2 ===
--- ZODB3/ZEO/ClientCache.py:1.30.2.1 Wed Aug 28 16:27:28 2002
+++ ZODB3/ZEO/ClientCache.py Wed Aug 28 17:23:46 2002
@@ -228,26 +228,25 @@
if tfn:
try:
self._tracefile = open(tfn, "a")
- self.trace("Tracefile opened at %s" % time.ctime(time.time()),
- None)
+ self.trace("Tracefile %s" % time.ctime(time.time()))
except IOError:
self._tracefile = None
if self._tracefile is None:
- def notrace(msg, oid, version=None, data=None, serial=None):
+ def notrace(msg, oid=None, version=None, serial=None, data=None):
pass
self.trace = notrace
- def trace(self, msg, oid, version=None, data=None, serial=None):
+ def trace(self, msg, oid=None, version=None, serial=None, data=None):
# When tracing is disabled, this method is hidden by a dummy.
- parts = ["%14.3f" % time.time(), msg]
+ parts = ["%14.3f" % time.time(), "%d" % self._current, msg]
if oid is not None:
parts.append("%016x" % U64(oid))
if version is not None:
parts.append("v=%r" % version)
- if data is not None:
- parts.append("n=%d" % len(data))
- if serial is not None:
- parts.append("s=%016x" % U64(serial))
+ if serial is not None:
+ parts.append("s=%016x" % U64(serial))
+ if data is not None:
+ parts.append("n=%d" % len(data))
self._tracefile.write(" ".join(parts) + "\n")
def verify(self, verifyFunc):
@@ -330,7 +329,7 @@
if not vlen or not version:
if dlen:
data = read(dlen)
- self.trace("load hit ", oid, version, data, h[19:])
+ self.trace("load hit ", oid, version, h[19:], data)
return data, h[19:]
else:
self.trace("load nove", oid, version)
@@ -344,7 +343,7 @@
if dlen:
seek(p+27)
data = read(dlen)
- self.trace("load nvhi", oid, version, data, h[19:])
+ self.trace("load nvhi", oid, version, h[19:], data)
return data, h[19:]
else:
self.trace("load vmis", oid, version)
@@ -353,7 +352,7 @@
vdlen = unpack(">i", vheader[-4:])[0]
vdata = read(vdlen)
vserial = read(8)
- self.trace("load vhit", oid, version, vdata, vserial)
+ self.trace("load vhit", oid, version, vserial, vdata)
return vdata, vserial
finally:
self._release()
@@ -363,7 +362,7 @@
try:
if version:
# We need to find and include non-version data
- self.trace("upda vers", oid, version, data, serial)
+ self.trace("upda vers", oid, version, serial, data)
p = self._get(oid, None)
if p is None:
return self._store(oid, '', '', version, data, serial)
@@ -390,7 +389,7 @@
self._store(oid, nvdata, nvserial, version, data, serial)
else:
# Simple case, just store new data:
- self.trace("upda nove", oid, version, data, serial)
+ self.trace("upda nove", oid, version, serial, data)
self._store(oid, data, serial, '', None, None)
finally:
self._release()
@@ -445,6 +444,7 @@
if self._pos + size > self._limit:
current = not self._current
self._current = current
+ self.trace("Flip-file %s" % time.ctime(time.time()))
log("flipping cache files. new current = %d" % current)
# Delete the half of the index that's no longer valid
index = self._index
@@ -473,6 +473,10 @@
def store(self, oid, p, s, version, pv, sv):
self._acquire()
+ if s:
+ self.trace("stor nove", oid, version, s, p)
+ else:
+ self.trace("stor vers", oid, version, sv, pv)
try:
self._store(oid, p, s, version, pv, sv)
finally: