[CalendarServer-changes] [6563] CalendarServer/trunk/contrib/performance/report.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Nov 3 14:40:16 PDT 2010


Revision: 6563
          http://trac.macosforge.org/projects/calendarserver/changeset/6563
Author:   exarkun at twistedmatrix.com
Date:     2010-11-03 14:40:13 -0700 (Wed, 03 Nov 2010)
Log Message:
-----------
Use stats.select() instead of re-implementing all of this.

This is preparation for being able to squash statistics in different ways.

Modified Paths:
--------------
    CalendarServer/trunk/contrib/performance/report.py

Modified: CalendarServer/trunk/contrib/performance/report.py
===================================================================
--- CalendarServer/trunk/contrib/performance/report.py	2010-11-03 20:00:51 UTC (rev 6562)
+++ CalendarServer/trunk/contrib/performance/report.py	2010-11-03 21:40:13 UTC (rev 6563)
@@ -1,39 +1,17 @@
 import sys, pickle
 
+from benchlib import select
 
 def main():
-    statistics = pickle.load(file(sys.argv[1]))
+    if len(sys.argv) < 5:
+        print 'Usage: %s <datafile> <benchmark name> <parameter value> <metric> [command]' % (sys.argv[0],)
+    else:
+        stat, samples = select(pickle.load(file(sys.argv[1])), *sys.argv[2:5])
+        if len(sys.argv) == 5:
+            print 'Samples'
+            print '\t' + '\n\t'.join(map(str, samples))
+            print 'Commands'
+            print '\t' + '\n\t'.join(stat.commands)
+        else:
+            getattr(stat, sys.argv[5])(samples)
 
-    if len(sys.argv) == 2:
-        print 'Available benchmarks'
-        print '\t' + '\n\t'.join(statistics.keys())
-        return
-
-    statistics = statistics[sys.argv[2]]
-
-    if len(sys.argv) == 3:
-        print 'Available parameters'
-        print '\t' + '\n\t'.join(map(str, statistics.keys()))
-        return
-
-    statistics = statistics[int(sys.argv[3])]
-
-    if len(sys.argv) == 4:
-        print 'Available statistics'
-        print '\t' + '\n\t'.join([s.name for s in statistics])
-        return
-
-    for stat in statistics:
-        if stat.name == sys.argv[4]:
-            samples = statistics[stat]
-            break
-
-    if len(sys.argv) == 5:
-        print 'Samples'
-        print '\t' + '\n\t'.join(map(str, samples))
-        print 'Commands'
-        print '\t' + '\n\t'.join(stat.commands)
-        return
-
-    getattr(stat, sys.argv[5])(samples)
-
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20101103/cc2bf3e0/attachment.html>


More information about the calendarserver-changes mailing list