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

source_changes at macosforge.org source_changes at macosforge.org
Fri Feb 9 11:52:25 PST 2007


Revision: 1154
          http://trac.macosforge.org/projects/calendarserver/changeset/1154
Author:   cdaboo at apple.com
Date:     2007-02-09 11:52:25 -0800 (Fri, 09 Feb 2007)

Log Message:
-----------
Python script to get fs_usage stats from a server when it executes a specific CalDAVTester script.

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

Added: CalDAVTester/trunk/fsusage.py
===================================================================
--- CalDAVTester/trunk/fsusage.py	                        (rev 0)
+++ CalDAVTester/trunk/fsusage.py	2007-02-09 19:52:25 UTC (rev 1154)
@@ -0,0 +1,72 @@
+#!/usr/bin/env python
+#
+##
+# Copyright (c) 2006-2007 Apple Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# DRI: Cyrus Daboo, cdaboo at apple.com
+##
+#
+# Creates some test accounts on an OpenDirectory server for use with CalDAVTester
+#
+import time
+import subprocess
+
+from src.manager import manager
+import getopt
+import os
+import signal
+import sys
+
+def usage():
+    print """Usage: fsusage [options]
+Options:
+    -h       Print this help and exit
+    -f file  pid file of caldavd server
+"""
+
+if __name__ == "__main__":
+
+    options, args = getopt.getopt(sys.argv[1:], "f:")
+
+    for option, value in options:
+        if option == "-h":
+            usage()
+            sys.exit(0)
+        elif option == "-f":
+            pidfile = value
+        else:
+            print "Unrecognized option: %s" % (option,)
+            usage()
+            raise ValueError
+
+    # First try to get pid of caldavd process
+    fd = open(pidfile, "r")
+    s = fd.read()
+    pid = int(s)
+    fd = None
+    
+    fd = open("temp", "w")
+    cid = subprocess.Popen(["fs_usage", "-f", "filesys", "%s" %(pid,),], ).pid
+    
+    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)


Property changes on: CalDAVTester/trunk/fsusage.py
___________________________________________________________________
Name: svn:executable
   + *

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


More information about the calendarserver-changes mailing list