[Zodb-checkins] CVS: ZODB3/ZEO - simul.py:1.12.8.2.18.13
Tim Peters
cvs-admin at zope.org
Thu Dec 4 22:51:17 EST 2003
Update of /cvs-repository/ZODB3/ZEO
In directory cvs.zope.org:/tmp/cvs-serv13962/ZEO
Modified Files:
Tag: Zope-2_6-branch
simul.py
Log Message:
Added UnboundedSimulation (-U), which never forgets or evicts anything.
No scheme can possibly do better than this, no matter how big its
cache. For zope.org-main,
UnboundedSimulation, cache size [irrelevant]
START TIME DURATION LOADS HITS INVALS WRITES HITRATE EVICTS
Nov 25 00:36 2:19:55 51340 19243 130 116 37.5% 0
Nov 25 02:56 1:55:01 54952 44369 66 442 80.7% 0
Nov 25 04:51 1:30:01 72530 64888 103 97 89.5% 0
Nov 25 06:21 1:00:13 46689 44533 33 111 95.4% 0
Nov 25 07:21 1:45:09 53628 50609 121 143 94.4% 0
Nov 25 09:06 1:15:02 58238 53737 51 163 92.3% 0
Nov 25 10:21 2:05:01 126466 115139 693 4751 91.0% 0
Nov 25 12:26 1:15:03 51919 50926 72 68 98.1% 0
Nov 25 13:41 2:45:03 69965 67569 608 296 96.6% 0
Nov 25 16:26 4:19:34 37131 34935 5 38 94.1% 0
Nov 25 20:46 6:05:06 110716 105092 324 2605 94.9% 0
Nov 26 02:51 2:04:57 79765 77765 837 1157 97.5% 0
Nov 26 04:56 40:01 53910 52593 140 187 97.6% 0
Nov 26 05:36 1:15:11 51677 50814 35 456 98.3% 0
Nov 26 06:51 1:00:08 51355 50782 49 92 98.9% 0
Nov 26 07:51 1:04:56 51923 50948 32 68 98.1% 0
Nov 26 08:56 1:05:13 66551 65701 33 90 98.7% 0
Nov 26 10:01 50:04 48137 47441 31 80 98.6% 0
Nov 26 10:51 28:00 40506 40199 30 70 99.2% 0
Nov 25 00:36 34:43:38 1177398 1087283 3393 11030 92.3% 0 OVERALL
=== ZODB3/ZEO/simul.py 1.12.8.2.18.12 => 1.12.8.2.18.13 ===
--- ZODB3/ZEO/simul.py:1.12.8.2.18.12 Thu Dec 4 22:29:14 2003
+++ ZODB3/ZEO/simul.py Thu Dec 4 22:51:16 2003
@@ -47,7 +47,7 @@
simclass = ZEOCacheSimulation
theta = omicron = None
try:
- opts, args = getopt.getopt(sys.argv[1:], "bflyz2cOaTs:o:t:")
+ opts, args = getopt.getopt(sys.argv[1:], "bflyz2cOaTUs:o:t:")
except getopt.error, msg:
usage(msg)
return 2
@@ -78,6 +78,8 @@
simclass = ARCCacheSimulation
if o == '-T':
simclass = ThorSimulation
+ if o == '-U':
+ simclass = UnboundedSimulation
if len(args) != 1:
usage("exactly one file argument required")
@@ -1643,6 +1645,36 @@
self.invals += 1
self.total_invals += 1
self._evict_without_bumping_evict_stats(obj)
+
+#############################################################################
+# Perfection: What if the cache were unbounded, and never forgot anything?
+# This simulator answers that question directly; the cache size parameter
+# isn't used.
+
+class UnboundedSimulation(Simulation):
+
+ extraname = 'evicts' # for some reason we *have* to define >= 1 extra
+
+ def __init__(self, cachelimit):
+ Simulation.__init__(self, cachelimit)
+ self.oids = Set()
+ self.evicts = self.total_evicts = 0
+
+ def write(self, oid, size):
+ self.oids.add(oid)
+
+ def load(self, oid, size):
+ if oid in self.oids:
+ self.hits += 1
+ self.total_hits += 1
+ else:
+ self.oids.add(oid)
+
+ def inval(self, oid):
+ if oid in self.oids:
+ self.invals += 1
+ self.total_invals += 1
+ self.oids.remove(oid)
if __name__ == "__main__":
sys.exit(main())
More information about the Zodb-checkins
mailing list