[CalendarServer-changes] [15681] CalendarServer/trunk/calendarserver/tools/dashtime.py

source_changes at macosforge.org source_changes at macosforge.org
Fri Jun 17 11:28:09 PDT 2016


Revision: 15681
          http://trac.calendarserver.org//changeset/15681
Author:   cdaboo at apple.com
Date:     2016-06-17 11:28:09 -0700 (Fri, 17 Jun 2016)
Log Message:
-----------
Improve stacked chart layout. Make sure perHost y-max operates on the same measurement type.

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tools/dashtime.py

Modified: CalendarServer/trunk/calendarserver/tools/dashtime.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/dashtime.py	2016-06-17 13:51:36 UTC (rev 15680)
+++ CalendarServer/trunk/calendarserver/tools/dashtime.py	2016-06-17 18:28:09 UTC (rev 15681)
@@ -475,18 +475,18 @@
         # Offset data that is averaged over the previous minute. Also determine
         # the highest max value of all the per-host measurements and scale each
         # per-host plot to the same range.
-        overall_ymax = 0
+        overall_ymax = defaultdict(int)
         for host in hosts:
             for measurement in perhostkeys:
                 ykey = "{}={}".format(measurement, host)
-                overall_ymax = max(overall_ymax, max(y[ykey]))
+                overall_ymax[measurement] = max(overall_ymax[measurement], max(y[ykey]))
                 if DataType.skip(measurement):
                     y[ykey] = y[ykey][60:]
                     y[ykey].extend([None] * 60)
         for host in hosts:
             for measurement in perhostkeys:
                 ykey = "{}={}".format(measurement, host)
-                ymaxes[ykey] = overall_ymax
+                ymaxes[ykey] = overall_ymax[measurement]
 
         for measurement in combinedkeys:
             if DataType.skip(measurement):
@@ -516,7 +516,16 @@
 #        JobQueueDataType.key,
 #    ))
 
+    # Generic aggregated data for all hosts
+    combinedHosts((
+        CPUDataType.key,
+        RequestsDataType.key,
+        ResponseDataType.key,
+        JobsCompletedDataType.key,
+        JobQueueDataType.key,
+    ))
 
+
     # Data aggregated for all hosts - method detail
 #    combinedHosts((
 #        CPUDataType.key,
@@ -537,27 +546,23 @@
 #    ))
 
     # Per-host job completion, and total CPU, total jobs queued
-#    singleHost((
+#    perHost((
+#        JobsCompletedDataType.key,
+#    ), (
 #        CPUDataType.key,
-#        JobsCompletedDataType.key,
 #        JobQueueDataType.key,
 #    ))
-    perHost((
-        JobsCompletedDataType.key,
-    ), (
-        CPUDataType.key,
-        JobQueueDataType.key,
-    ))
 
     # Generate a single stacked plot of the data
+    plotmax = len(y.keys())
     for plotnum, measurement in enumerate(y.keys()):
         plt.subplot(len(y), 1, plotnum + 1)
-        plotSeries(titles[measurement], x, y[measurement], 0, ymaxes[measurement])
+        plotSeries(titles[measurement], x, y[measurement], 0, ymaxes[measurement], plotnum == plotmax - 1)
     plt.show()
 
 
 
-def plotSeries(title, x, y, ymin=None, ymax=None):
+def plotSeries(title, x, y, ymin=None, ymax=None, last_subplot=True):
     """
     Plot the chosen dataset key for each scanned data file.
 
@@ -571,8 +576,12 @@
 
     plt.plot(x, y)
 
-    plt.xlabel("Time")
-    plt.ylabel(title)
+    if last_subplot:
+        plt.xlabel("Time")
+    else:
+        frame = plt.gca()
+        frame.axes.xaxis.set_ticklabels([])
+    plt.ylabel(title, fontsize="small", horizontalalignment="right", rotation="horizontal")
     if ymin is not None:
         plt.ylim(ymin=ymin)
     if ymax is not None:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20160617/33a3e1b7/attachment.html>


More information about the calendarserver-changes mailing list