[Zope-CVS] CVS: Products/FileCacheManager/tests - stresstest.py:1.5
Jens Vagelpohl
jens at dataflake.org
Wed Aug 18 14:46:17 EDT 2004
Update of /cvs-repository/Products/FileCacheManager/tests
In directory cvs.zope.org:/tmp/cvs-serv13260/tests
Modified Files:
stresstest.py
Log Message:
- add more informative output
=== Products/FileCacheManager/tests/stresstest.py 1.4 => 1.5 ===
--- Products/FileCacheManager/tests/stresstest.py:1.4 Wed Aug 18 11:57:43 2004
+++ Products/FileCacheManager/tests/stresstest.py Wed Aug 18 14:46:16 2004
@@ -54,7 +54,7 @@
"""
READERS=10
WRITERS=3
-ITERATIONS = 100
+ITERATIONS = 50
# End tweakable items
######################
@@ -124,7 +124,8 @@
class ReadStresser(threading.Thread):
""" Objects that simulate read or write access to the cached resources """
- def __init__(self, root, paths, iterations):
+ def __init__(self, number, root, paths, iterations):
+ self.number = number
self.root = root
self.paths = paths
self.iterations = iterations
@@ -132,7 +133,12 @@
threading.Thread.__init__(self)
def run(self):
+ counter = 0
+ n_counter = 0
+ e_counter = 0
+ c_counter = 0
for i in range(self.iterations):
+ counter += 1
for path in self.paths:
root = makerequest.makerequest(self.root)
ob = root.unrestrictedTraverse(path)
@@ -153,13 +159,21 @@
if not data:
print 'N',
sys.stdout.flush()
+ n_counter += 1
if data != original_data:
print 'E',
sys.stdout.flush()
+ e_counter += 1
if ob.ZCacheable_get(default=None) is None:
print 'C',
sys.stdout.flush()
+ c_counter += 1
+ print '\n\nReader %d: %d total requests' % (self.number, counter)
+ print 'Reader %d: %d empty responses' % (self.number, n_counter)
+ print 'Reader %d: %d times faulty data returned' % (self.number, e_counter)
+ print 'Reader %d: %d empty results in cache' % (self.number, c_counter)
+ sys.stdout.flush()
self.finished = 1
def isFinished(self):
@@ -168,7 +182,8 @@
class WriteStresser(threading.Thread):
""" Objects that simulate read or write access to the cached resources """
- def __init__(self, root, paths, iterations):
+ def __init__(self, number, root, paths, iterations):
+ self.number = number
self.root = root
self.paths = paths
self.iterations = iterations
@@ -238,11 +253,11 @@
###
for i in range(READERS):
- thread = ReadStresser(ROOT, paths, ITERATIONS)
+ thread = ReadStresser(i, ROOT, paths, ITERATIONS)
readers.append(thread)
for i in range(WRITERS):
- thread = WriteStresser(ROOT, paths, ITERATIONS)
+ thread = WriteStresser(i, ROOT, paths, ITERATIONS)
writers.append(thread)
for reader in readers:
@@ -257,6 +272,10 @@
time.sleep(1)
def run():
+ #print 'Cleanup...'
+ #sys.stdout.flush()
+ #tearDown()
+
print 'Setting up...'
sys.stdout.flush()
setUp()
@@ -265,9 +284,9 @@
sys.stdout.flush()
stress()
- print 'Tearing down...'
- sys.stdout.flush()
- tearDown()
+ #print 'Tearing down...'
+ #sys.stdout.flush()
+ #tearDown()
if __name__ == '__main__':
More information about the Zope-CVS
mailing list