[Zope3-checkins] CVS: Zope3/utilities - runurl.py:1.2

Jim Fulton jim@zope.com
Tue, 13 May 2003 17:11:11 -0400


Update of /cvs-repository/Zope3/utilities
In directory cvs.zope.org:/tmp/cvs-serv14390

Modified Files:
	runurl.py 
Log Message:
Added summary statistics.


=== Zope3/utilities/runurl.py 1.1 => 1.2 ===
--- Zope3/utilities/runurl.py:1.1	Fri May  2 14:28:18 2003
+++ Zope3/utilities/runurl.py	Tue May 13 17:11:11 2003
@@ -131,10 +131,22 @@
 resultfmt = "elapsed: %.4f, cpu=%.4f, status=%s"
 def _mainrun(app, path, basic, run, stdin, environment):
     if run:
+        es = []
+        cs = []
         for i in range(run):
-            print resultfmt %  app.run(path=path, basic=basic, stdin=stdin,
-                                       environment=environment)
-            
+            e, c, status = app.run(path=path, basic=basic, stdin=stdin,
+                                   environment=environment)
+            es.append(e)
+            cs.append(c)
+            print resultfmt % (e, c, status)
+
+        if run > 1:
+            print "min elapsted: %.4f, min cpu=%.4f" % (min(es), min(cs))
+            es.sort()
+            cs.sort()
+            e = (es[(run+1)/2-1]+es[(run+2)/2-1]) / 2.0
+            c = (cs[(run+1)/2-1]+cs[(run+2)/2-1]) / 2.0
+            print "med elapsted: %.4f, med cpu=%.4f" % (e, c)
     else:
         print resultfmt % app.publish(path=path, basic=basic, stdin=stdin,
                                       environment=environment)