<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[1476] CalendarServer/trunk</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.macosforge.org/projects/calendarserver/changeset/1476">1476</a></dd>
<dt>Author</dt> <dd>dreid@apple.com</dd>
<dt>Date</dt> <dd>2007-04-11 17:40:28 -0700 (Wed, 11 Apr 2007)</dd>
</dl>

<h3>Log Message</h3>
<pre>Ability to run twistd with profiling enabled</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServertrunkbincaldavd">CalendarServer/trunk/bin/caldavd</a></li>
<li><a href="#CalendarServertrunkrun">CalendarServer/trunk/run</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServertrunkbincaldavd"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/bin/caldavd (1475 => 1476)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> twistdpath=&quot;$(type -p twistd)&quot;;
</span><span class="cx"> plugin_name=&quot;caldav&quot;;
</span><span class="cx"> service_type=&quot;&quot;;
</span><ins>+profile=&quot;&quot;;
</ins><span class="cx"> 
</span><span class="cx"> py_version ()
</span><span class="cx"> {
</span><span class="lines">@@ -79,7 +80,7 @@
</span><span class="cx">     
</span><span class="cx">     if [ &quot;${1--}&quot; != &quot;-&quot; ]; then echo &quot;$@&quot;; echo; fi;
</span><span class="cx"> 
</span><del>-    echo &quot;Usage: ${program} [-hX] [-u username] [-g groupname] [-T twistd] [-t type] [-f caldavd.plist]&quot;;
</del><ins>+    echo &quot;Usage: ${program} [-hX] [-u username] [-g groupname] [-T twistd] [-t type] [-f caldavd.plist] [-p statsfile]&quot;;
</ins><span class="cx">     echo &quot;Options:&quot;;
</span><span class="cx">     echo &quot;        -h Print this help and exit&quot;;
</span><span class="cx">     echo &quot;        -X Do not daemonize&quot;;
</span><span class="lines">@@ -88,12 +89,13 @@
</span><span class="cx">     echo &quot;        -f Configuration file to read&quot;;
</span><span class="cx">     echo &quot;        -T Path to twistd binary&quot;;
</span><span class="cx">     echo &quot;        -t Process type (Master, Slave or Combined)&quot;;
</span><ins>+    echo &quot;        -p Path to the desired pstats file.&quot;;
</ins><span class="cx">     
</span><span class="cx">     if [ &quot;${1-}&quot; == &quot;-&quot; ]; then return 0; fi;
</span><span class="cx">     exit 64;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-while getopts 'hXu:g:f:T:P:t:' option; do
</del><ins>+while getopts 'hXu:g:f:T:P:t:p:' option; do
</ins><span class="cx">     case &quot;${option}&quot; in
</span><span class="cx">         '?') usage; ;;
</span><span class="cx">         'h') usage -; exit 0; ;;
</span><span class="lines">@@ -104,6 +106,7 @@
</span><span class="cx">         'g') groupname=&quot;-g ${OPTARG}&quot;; ;;
</span><span class="cx">         'P') plugin_name=&quot;${OPTARG}&quot;; ;;
</span><span class="cx">         't') service_type=&quot;-o ProcessType=${OPTARG}&quot;; ;;
</span><ins>+        'p') profile=&quot;--profile=${OPTARG} --nothotshot --savestats&quot;; ;;
</ins><span class="cx">     esac;
</span><span class="cx"> done;
</span><span class="cx"> 
</span><span class="lines">@@ -113,4 +116,4 @@
</span><span class="cx"> 
</span><span class="cx"> export PYTHONPATH
</span><span class="cx"> 
</span><del>-exec &quot;${python}&quot; &quot;${twistdpath}&quot; ${daemonize} ${username} ${groupname} &quot;${plugin_name}&quot; ${configfile} ${service_type};
</del><ins>+exec &quot;${python}&quot; &quot;${twistdpath}&quot; ${daemonize} ${username} ${groupname} ${profile} &quot;${plugin_name}&quot; ${configfile} ${service_type};
</ins></span></pre></div>
<a id="CalendarServertrunkrun"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/run (1475 => 1476)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/run        2007-04-11 21:36:28 UTC (rev 1475)
+++ CalendarServer/trunk/run        2007-04-12 00:40:28 UTC (rev 1476)
</span><span class="lines">@@ -39,6 +39,7 @@
</span><span class="cx">   plugin_name=&quot;caldav&quot;;
</span><span class="cx">  service_type=&quot;Combined&quot;;
</span><span class="cx">      read_key=&quot;&quot;;
</span><ins>+      profile=&quot;&quot;;
</ins><span class="cx"> 
</span><span class="cx"> usage ()
</span><span class="cx"> {
</span><span class="lines">@@ -46,7 +47,7 @@
</span><span class="cx"> 
</span><span class="cx">   if [ &quot;${1--}&quot; != &quot;-&quot; ]; then echo &quot;$@&quot;; echo; fi;
</span><span class="cx"> 
</span><del>-  echo &quot;Usage: ${program} [-hvsfpndkr] [-K key] [-iI dst] [-t type]&quot;;
</del><ins>+  echo &quot;Usage: ${program} [-hvsfpndkr] [-K key] [-iI dst] [-t type] [-S statsfile]&quot;;
</ins><span class="cx">   echo &quot;Options:&quot;;
</span><span class="cx">   echo &quot;        -h  Print this help and exit&quot;;
</span><span class="cx">   echo &quot;        -v  Be verbose&quot;;
</span><span class="lines">@@ -61,12 +62,13 @@
</span><span class="cx">   echo &quot;        -i  Perform a system install into dst; implies -s&quot;;
</span><span class="cx">   echo &quot;        -I  Perform a home install into dst; implies -s&quot;;
</span><span class="cx">   echo &quot;        -t  Select the server process type (Master, Slave or Combined)&quot;;
</span><ins>+  echo &quot;        -S  Write a pstats object to the given file when the server is stopped.&quot;;
</ins><span class="cx"> 
</span><span class="cx">   if [ &quot;${1-}&quot; == &quot;-&quot; ]; then return 0; fi;
</span><span class="cx">   exit 64;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-while getopts 'hvsfnpkrdP:i:I:t:K:' option; do
</del><ins>+while getopts 'hvsfnpkrdP:i:I:t:K:S:' option; do
</ins><span class="cx">   case &quot;$option&quot; in
</span><span class="cx">     '?') usage; ;;
</span><span class="cx">     'h') usage -; exit 0; ;;
</span><span class="lines">@@ -83,6 +85,7 @@
</span><span class="cx">     'I')    setup_only=&quot;true&quot;; install=&quot;${wd}/build/dst&quot;; install_flag=&quot;--root=&quot;; install_home=&quot;${OPTARG}&quot;; ;;
</span><span class="cx">     't')  service_type=&quot;${OPTARG}&quot;; ;;
</span><span class="cx">     'K')      read_key=&quot;${OPTARG}&quot;; ;;
</span><ins>+    'S')       profile=&quot;-p ${OPTARG}&quot;; ;;
</ins><span class="cx">   esac;
</span><span class="cx"> done;
</span><span class="cx"> shift $((${OPTIND} - 1));
</span><span class="lines">@@ -231,7 +234,8 @@
</span><span class="cx">         -f &quot;${config}&quot;                                \
</span><span class="cx">         -T &quot;${twisted}/bin/twistd&quot;                    \
</span><span class="cx">         -P &quot;${plugin_name}&quot;                           \
</span><del>-        -t &quot;${service_type}&quot;;
</del><ins>+        -t &quot;${service_type}&quot;                          \
+        ${profile};
</ins><span class="cx">     cd /;
</span><span class="cx">   fi;
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>