[CalendarServer-changes] [1157] CalDAVTester/trunk/fsusage.py

source_changes at macosforge.org source_changes at macosforge.org
Fri Feb 9 13:47:35 PST 2007


Revision: 1157
          http://trac.macosforge.org/projects/calendarserver/changeset/1157
Author:   cdaboo at apple.com
Date:     2007-02-09 13:47:34 -0800 (Fri, 09 Feb 2007)

Log Message:
-----------
Fix comment. Allow loop over several scripts and produce tabular output.

Modified Paths:
--------------
    CalDAVTester/trunk/fsusage.py

Modified: CalDAVTester/trunk/fsusage.py
===================================================================
--- CalDAVTester/trunk/fsusage.py	2007-02-09 21:42:50 UTC (rev 1156)
+++ CalDAVTester/trunk/fsusage.py	2007-02-09 21:47:34 UTC (rev 1157)
@@ -18,9 +18,9 @@
 # DRI: Cyrus Daboo, cdaboo at apple.com
 ##
 #
-# Creates some test accounts on an OpenDirectory server for use with CalDAVTester
+# Generates fs_usage counts for CalDAVTester script runs.
 #
-import time
+
 import subprocess
 
 from src.manager import manager
@@ -36,6 +36,26 @@
     -f file  pid file of caldavd server
 """
 
+def getFSUsage(testscript, runs, pid):
+    fd = open("temp", "w")
+    cid = subprocess.Popen(["fs_usage", "-f", "filesys", "%s" %(pid,),], stdout=fd).pid
+    
+    sname = "scripts/server/serverinfo.xml"
+    pname = None
+    fnames = [testscript]
+
+    mgr = manager(level=manager.LOG_NONE)
+    result, timing = mgr.runWithOptions(sname, pname, fnames, {})
+
+    os.kill(cid, signal.SIGTERM)
+
+    fd = open("temp", "r")
+    ctr = 0
+    for line in fd:
+        ctr += 1
+
+    return ctr / runs
+
 if __name__ == "__main__":
 
     options, args = getopt.getopt(sys.argv[1:], "f:")
@@ -57,16 +77,16 @@
     pid = int(s)
     fd = None
     
-    fd = open("temp", "w")
-    cid = subprocess.Popen(["fs_usage", "-f", "filesys", "%s" %(pid,),], ).pid
+    tests = (
+        ("performance/get/get-small.xml", 10, "GET small",),
+        ("performance/get/get-large.xml", 10, "GET large",),
+        ("performance/put/put-small.xml", 10, "PUT small",),
+        ("performance/put/put-large.xml", 10, "PUT large",),
+        ("performance/propfind/propfind-small.xml", 10, "PROPFIND small",),
+        ("performance/propfind/propfind-medium.xml", 10, "PROPFIND medium",),
+        ("performance/propfind/propfind-large.xml", 10, "PROPFIND large",),
+    )
     
-    sname = "scripts/server/serverinfo.xml"
-    pname = None
-    fnames = ["performance/propfind/propfind-large.xml"]
-
-    mgr = manager(level=manager.LOG_NONE)
-    result, timing = mgr.runWithOptions(sname, pname, fnames, {})
-
-    print cid
-    #time.sleep(5)
-    os.kill(cid, signal.SIGTERM)
+    result = []
+    for test in tests:
+        print "%s\t%s" % (test[2], getFSUsage(test[0], test[1], pid),)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20070209/3cfcb445/attachment.html


More information about the calendarserver-changes mailing list