[Zodb-checkins] CVS: StandaloneZODB/ZEO/tests - speed.py:1.1.2.4
Jeremy Hylton
jeremy@zope.com
Fri, 4 Jan 2002 17:16:37 -0500
Update of /cvs-repository/StandaloneZODB/ZEO/tests
In directory cvs.zope.org:/tmp/cvs-serv12762/tests
Modified Files:
Tag: ZEO-ZRPC-Dev
speed.py
Log Message:
Add a simple profile option
=== StandaloneZODB/ZEO/tests/speed.py 1.1.2.3 => 1.1.2.4 ===
-t n Number of concurrent threads to run.
+
+ -P file Put profile data in this file.
"""
import asyncore
@@ -116,12 +118,13 @@
jar.cacheMinimize(3)
def main(args):
- opts, args = getopt.getopt(args, 'zd:n:Ds:LMt:U')
+ opts, args = getopt.getopt(args, 'zd:n:Ds:LMt:UP:')
s = None
compress = None
data=sys.argv[0]
nrep=5
minimize=0
+ profile=0
detailed=1
cache = None
domain = 'AF_INET'
@@ -148,6 +151,9 @@
domain = 'AF_UNIX'
elif o == '-t':
threads = int(v)
+ elif o == '-P':
+ profile = v
+ import hotshot
zeo_pipe = None
if s:
@@ -180,7 +186,12 @@
t.join()
else:
- work(db, results, nrep, compress, data, detailed, minimize)
+ if profile:
+ p = hotshot.Profile(profile)
+ p.runctx("work(db, results, nrep, compress, data, detailed, minimize)",
+ globals(), locals())
+ else:
+ work(db, results, nrep, compress, data, detailed, minimize)
if server is not None:
server.close()