[CalendarServer-changes] [1476] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Wed Apr 11 17:40:28 PDT 2007


Revision: 1476
          http://trac.macosforge.org/projects/calendarserver/changeset/1476
Author:   dreid at apple.com
Date:     2007-04-11 17:40:28 -0700 (Wed, 11 Apr 2007)

Log Message:
-----------
Ability to run twistd with profiling enabled

Modified Paths:
--------------
    CalendarServer/trunk/bin/caldavd
    CalendarServer/trunk/run

Modified: CalendarServer/trunk/bin/caldavd
===================================================================
--- CalendarServer/trunk/bin/caldavd	2007-04-11 21:36:28 UTC (rev 1475)
+++ CalendarServer/trunk/bin/caldavd	2007-04-12 00:40:28 UTC (rev 1476)
@@ -28,6 +28,7 @@
 twistdpath="$(type -p twistd)";
 plugin_name="caldav";
 service_type="";
+profile="";
 
 py_version ()
 {
@@ -79,7 +80,7 @@
     
     if [ "${1--}" != "-" ]; then echo "$@"; echo; fi;
 
-    echo "Usage: ${program} [-hX] [-u username] [-g groupname] [-T twistd] [-t type] [-f caldavd.plist]";
+    echo "Usage: ${program} [-hX] [-u username] [-g groupname] [-T twistd] [-t type] [-f caldavd.plist] [-p statsfile]";
     echo "Options:";
     echo "        -h Print this help and exit";
     echo "        -X Do not daemonize";
@@ -88,12 +89,13 @@
     echo "        -f Configuration file to read";
     echo "        -T Path to twistd binary";
     echo "        -t Process type (Master, Slave or Combined)";
+    echo "        -p Path to the desired pstats file.";
     
     if [ "${1-}" == "-" ]; then return 0; fi;
     exit 64;
 }
 
-while getopts 'hXu:g:f:T:P:t:' option; do
+while getopts 'hXu:g:f:T:P:t:p:' option; do
     case "${option}" in
         '?') usage; ;;
         'h') usage -; exit 0; ;;
@@ -104,6 +106,7 @@
         'g') groupname="-g ${OPTARG}"; ;;
         'P') plugin_name="${OPTARG}"; ;;
         't') service_type="-o ProcessType=${OPTARG}"; ;;
+        'p') profile="--profile=${OPTARG} --nothotshot --savestats"; ;;
     esac;
 done;
 
@@ -113,4 +116,4 @@
 
 export PYTHONPATH
 
-exec "${python}" "${twistdpath}" ${daemonize} ${username} ${groupname} "${plugin_name}" ${configfile} ${service_type};
+exec "${python}" "${twistdpath}" ${daemonize} ${username} ${groupname} ${profile} "${plugin_name}" ${configfile} ${service_type};

Modified: CalendarServer/trunk/run
===================================================================
--- CalendarServer/trunk/run	2007-04-11 21:36:28 UTC (rev 1475)
+++ CalendarServer/trunk/run	2007-04-12 00:40:28 UTC (rev 1476)
@@ -39,6 +39,7 @@
   plugin_name="caldav";
  service_type="Combined";
      read_key="";
+      profile="";
 
 usage ()
 {
@@ -46,7 +47,7 @@
 
   if [ "${1--}" != "-" ]; then echo "$@"; echo; fi;
 
-  echo "Usage: ${program} [-hvsfpndkr] [-K key] [-iI dst] [-t type]";
+  echo "Usage: ${program} [-hvsfpndkr] [-K key] [-iI dst] [-t type] [-S statsfile]";
   echo "Options:";
   echo "	-h  Print this help and exit";
   echo "	-v  Be verbose";
@@ -61,12 +62,13 @@
   echo "        -i  Perform a system install into dst; implies -s";
   echo "        -I  Perform a home install into dst; implies -s";
   echo "        -t  Select the server process type (Master, Slave or Combined)";
+  echo "        -S  Write a pstats object to the given file when the server is stopped.";
 
   if [ "${1-}" == "-" ]; then return 0; fi;
   exit 64;
 }
 
-while getopts 'hvsfnpkrdP:i:I:t:K:' option; do
+while getopts 'hvsfnpkrdP:i:I:t:K:S:' option; do
   case "$option" in
     '?') usage; ;;
     'h') usage -; exit 0; ;;
@@ -83,6 +85,7 @@
     'I')    setup_only="true"; install="${wd}/build/dst"; install_flag="--root="; install_home="${OPTARG}"; ;;
     't')  service_type="${OPTARG}"; ;;
     'K')      read_key="${OPTARG}"; ;;
+    'S')       profile="-p ${OPTARG}"; ;;
   esac;
 done;
 shift $((${OPTIND} - 1));
@@ -231,7 +234,8 @@
         -f "${config}"                                \
         -T "${twisted}/bin/twistd"                    \
         -P "${plugin_name}"                           \
-        -t "${service_type}";
+        -t "${service_type}"                          \
+        ${profile};
     cd /;
   fi;
 }

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20070411/0bd1b964/attachment.html


More information about the calendarserver-changes mailing list