<!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" />
<title>[15697] CalendarServer/trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { 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 #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#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>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.calendarserver.org//changeset/15697">15697</a></dd>
<dt>Author</dt> <dd>cdaboo@apple.com</dd>
<dt>Date</dt> <dd>2016-06-23 16:22:25 -0700 (Thu, 23 Jun 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>dashtime scatter plot.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServertrunkcalendarservertoolsdashtimepy">CalendarServer/trunk/calendarserver/tools/dashtime.py</a></li>
<li><a href="#CalendarServertrunkdocAdminDashboardmd">CalendarServer/trunk/doc/Admin/Dashboard.md</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServertrunkcalendarservertoolsdashtimepy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/calendarserver/tools/dashtime.py (15696 => 15697)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/calendarserver/tools/dashtime.py        2016-06-23 21:57:12 UTC (rev 15696)
+++ CalendarServer/trunk/calendarserver/tools/dashtime.py        2016-06-23 23:22:25 UTC (rev 15697)
</span><span class="lines">@@ -629,11 +629,27 @@
</span><span class="cx"> 
</span><span class="cx">     def plot(self):
</span><span class="cx">         # Generate a single stacked plot of the data
</span><del>-        plotmax = len(self.y.keys())
-        plt.figure(figsize=(18.5, min(5 + len(self.y.keys()), 18)))
-        for plotnum, measurement in enumerate(self.y.keys()):
-            plt.subplot(len(self.y), 1, plotnum + 1)
-            plotSeries(self.titles[measurement], self.x, self.y[measurement], 0, self.ymaxes[measurement], plotnum == plotmax - 1)
</del><ins>+        if self.mode.startswith(&quot;scatter&quot;):
+            plt.figure(figsize=(10, 10))
+            keys = self.y.keys()
+            x_key = CPUDataType.key
+            keys.remove(x_key)
+            plotmax = len(keys)
+            for plotnum, y_key in enumerate(keys):
+                plt.subplot(len(keys), 1, plotnum + 1)
+                plotScatter(
+                    self.titles[y_key],
+                    self.y[x_key], self.y[y_key],
+                    (0, self.ymaxes[x_key],),
+                    (0, self.ymaxes[y_key]),
+                    plotnum == plotmax - 1,
+                )
+        else:
+            plt.figure(figsize=(18.5, min(5 + len(self.y.keys()), 18)))
+            plotmax = len(self.y.keys())
+            for plotnum, measurement in enumerate(self.y.keys()):
+                plt.subplot(len(self.y), 1, plotnum + 1)
+                plotSeries(self.titles[measurement], self.x, self.y[measurement], 0, self.ymaxes[measurement], plotnum == plotmax - 1)
</ins><span class="cx">         if self.save:
</span><span class="cx">             plt.savefig(&quot;.&quot;.join((os.path.expanduser(self.logname), self.mode, &quot;png&quot;,)), orientation=&quot;landscape&quot;, format=&quot;png&quot;)
</span><span class="cx">         if not self.noshow:
</span><span class="lines">@@ -732,6 +748,16 @@
</span><span class="cx">                     JobQueueDataType.key,
</span><span class="cx">                 ),
</span><span class="cx">             ),
</span><ins>+        &quot;scatter&quot;:
+            # Scatter plots of request count and response time vs CPU
+            (
+                &quot;combinedHosts&quot;,
+                (
+                    CPUDataType.key,
+                    RequestsDataType.key,
+                    ResponseDataType.key,
+                )
+            ),
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     parser = ArgumentParser(
</span><span class="lines">@@ -752,13 +778,15 @@
</span><span class="cx">     response time, PUT-ics, REPORT cal-home-sync, PROPFIND Calendar Home, REPORT
</span><span class="cx">     cal-sync, and PROPFIND Calendar.
</span><span class="cx"> 
</span><del>-hostrequests = stacked plots of per-host request counts, total request count,
</del><ins>+hostrequests - stacked plots of per-host request counts, total request count,
</ins><span class="cx">     and total CPU.
</span><span class="cx"> 
</span><del>-hostcpu = stacked plots of per-host CPU, total request count, and total CPU.
</del><ins>+hostcpu - stacked plots of per-host CPU, total request count, and total CPU.
</ins><span class="cx"> 
</span><del>-hostcompleted = stacked plots of per-host completed jobs, total CPU, and job
</del><ins>+hostcompleted - stacked plots of per-host completed jobs, total CPU, and job
</ins><span class="cx">     queue size.
</span><ins>+
+scatter - scatter plot of request count and response time vs CPU.
</ins><span class="cx"> &quot;&quot;&quot;,
</span><span class="cx">     )
</span><span class="cx">     parser.add_argument(&quot;-l&quot;, default=SUPPRESS, required=True, help=&quot;Log file to process&quot;)
</span><span class="lines">@@ -806,5 +834,31 @@
</span><span class="cx">     plt.xticks(range(min(x), max(x) + 1, 60))
</span><span class="cx">     plt.grid(True, &quot;major&quot;, &quot;x&quot;, alpha=0.5, linewidth=0.5)
</span><span class="cx"> 
</span><ins>+
+
+def plotScatter(title, x, y, xlim=None, ylim=None, last_subplot=True):
+    &quot;&quot;&quot;
+    Plot the chosen dataset key for each scanned data file.
+
+    @param key: data set key to use
+    @type key: L{str}
+    @param xlim: minimum, maximum value for x-axis or L{None} for default
+    @type xlim: L{tuple} of two L{int} or L{float}
+    @param ylim: minimum, maximum value for y-axis or L{None} for default
+    @type ylim: L{tuple} of two L{int} or L{float}
+    &quot;&quot;&quot;
+
+    # Remove any None values
+    x, y = zip(*filter(lambda x: x[0] is not None and x[1] is not None, zip(x, y)))
+
+    plt.scatter(x, y, marker=&quot;.&quot;)
+
+    plt.xlabel(&quot;CPU&quot;)
+    plt.ylabel(title, fontsize=&quot;small&quot;, verticalalignment=&quot;center&quot;, rotation=&quot;vertical&quot;)
+    if xlim is not None:
+        plt.xlim(*xlim)
+    if ylim is not None:
+        plt.ylim(*ylim)
+
</ins><span class="cx"> if __name__ == &quot;__main__&quot;:
</span><span class="cx">     main()
</span></span></pre></div>
<a id="CalendarServertrunkdocAdminDashboardmd"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/doc/Admin/Dashboard.md (15696 => 15697)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/doc/Admin/Dashboard.md        2016-06-23 21:57:12 UTC (rev 15696)
+++ CalendarServer/trunk/doc/Admin/Dashboard.md        2016-06-23 23:22:25 UTC (rev 15697)
</span><span class="lines">@@ -154,7 +154,7 @@
</span><span class="cx">         dashtime.py --help
</span><span class="cx">         usage: dashtime.py [-h] -l L [-p P] [-s S] [--save] [--noshow] [--start START]
</span><span class="cx">                            [--count COUNT]
</span><del>-                           [--mode {basic,basicjob,basicmethod,basicschedule,hostcompleted,hostcpu,hostrequests}]
</del><ins>+                           [--mode {basic,basicjob,basicmethod,basicschedule,hostcompleted,hostcpu,hostrequests,scatter}]
</ins><span class="cx">                            [-v]
</span><span class="cx">         
</span><span class="cx">         Dashboard time series processor.
</span><span class="lines">@@ -169,7 +169,7 @@
</span><span class="cx">           --start START         Log line to start from (default: 0)
</span><span class="cx">           --count COUNT         Number of log lines to process from start (default:
</span><span class="cx">                                 -1)
</span><del>-          --mode {basic,basicjob,basicmethod,basicschedule,hostcompleted,hostcpu,hostrequests}
</del><ins>+          --mode {basic,basicjob,basicmethod,basicschedule,hostcompleted,hostcpu,hostrequests,scatter}
</ins><span class="cx">                                 Type of plot to produce (default: basic)
</span><span class="cx">           -v                    Verbose (default: False)
</span><span class="cx">         
</span><span class="lines">@@ -188,13 +188,15 @@
</span><span class="cx">             response time, PUT-ics, REPORT cal-home-sync, PROPFIND Calendar Home, REPORT
</span><span class="cx">             cal-sync, and PROPFIND Calendar.
</span><span class="cx">         
</span><del>-        hostrequests = stacked plots of per-host request counts, total request count,
</del><ins>+        hostrequests - stacked plots of per-host request counts, total request count,
</ins><span class="cx">             and total CPU.
</span><span class="cx">         
</span><del>-        hostcpu = stacked plots of per-host CPU, total request count, and total CPU.
</del><ins>+        hostcpu - stacked plots of per-host CPU, total request count, and total CPU.
</ins><span class="cx">         
</span><del>-        hostcompleted = stacked plots of per-host completed jobs, total CPU, and job
</del><ins>+        hostcompleted - stacked plots of per-host completed jobs, total CPU, and job
</ins><span class="cx">             queue size.
</span><ins>+        
+        scatter - scatter plot of request count and response time vs CPU.
</ins><span class="cx"> 
</span><span class="cx"> * The `-l` option must be present and point to a `dashcollect` log file.
</span><span class="cx"> * The `-p` option defines the pod to view data for (if not present the first pod - alphabetically sorted - is used).
</span></span></pre>
</div>
</div>

</body>
</html>