[CalendarServer-changes] [15640] CalendarServer/trunk/contrib/tools/protocolanalysis.py

source_changes at macosforge.org source_changes at macosforge.org
Thu May 26 13:09:17 PDT 2016


Revision: 15640
          http://trac.calendarserver.org//changeset/15640
Author:   cdaboo at apple.com
Date:     2016-05-26 13:09:17 -0700 (Thu, 26 May 2016)
Log Message:
-----------
Fix identification of clients in the "Protocol Analysis by Client" table.

Modified Paths:
--------------
    CalendarServer/trunk/contrib/tools/protocolanalysis.py

Modified: CalendarServer/trunk/contrib/tools/protocolanalysis.py
===================================================================
--- CalendarServer/trunk/contrib/tools/protocolanalysis.py	2016-05-26 18:54:53 UTC (rev 15639)
+++ CalendarServer/trunk/contrib/tools/protocolanalysis.py	2016-05-26 20:09:17 UTC (rev 15640)
@@ -486,8 +486,11 @@
                 self.clientByMethodAveragedTime[client][method] = totaltime / count if count else 0
 
         self.clientIDMap = {}
-        for ctr, client in enumerate(sorted(self.clientByMethodCount.keys())):
-            self.clientIDMap[client] = "ID-%02d" % (ctr + 1,)
+        for ctr, client in enumerate(sorted(self.clientByMethodCount.keys(), key=lambda x: x.lower())):
+            if ctr == 0:
+                self.clientIDMap[client] = "Total"
+            else:
+                self.clientIDMap[client] = "ID-%02d" % (ctr,)
         self.clientIDByMethodCount = {}
         for client, data in self.clientByMethodCount.iteritems():
             self.clientIDByMethodCount[self.clientIDMap[client]] = data
@@ -886,17 +889,19 @@
 
         table.setDefaultColumnFormats((
             tables.Table.ColumnFormat("%s", tables.Table.ColumnFormat.LEFT_JUSTIFY),
+            tables.Table.ColumnFormat("%s", tables.Table.ColumnFormat.LEFT_JUSTIFY),
             tables.Table.ColumnFormat("%s", tables.Table.ColumnFormat.RIGHT_JUSTIFY),
             tables.Table.ColumnFormat("%s", tables.Table.ColumnFormat.RIGHT_JUSTIFY),
             tables.Table.ColumnFormat("%s", tables.Table.ColumnFormat.RIGHT_JUSTIFY),
         ))
 
-        table.addHeader(("Client", "Total", "Unique", "Unique"))
-        table.addHeader(("", "", "Users", "IP addrs"))
+        table.addHeader(("ID", "Client", "Total", "Unique", "Unique"))
+        table.addHeader(("", "", "", "Users", "IP addrs"))
         for title, clientData in sorted(self.clientTotals.iteritems(), key=lambda x: x[0].lower()):
             if title == " TOTAL":
                 continue
             table.addRow((
+                "%s" % (self.clientIDMap[title],),
                 title,
                 "%d (%2d%%)" % (clientData[0], safePercent(clientData[0], self.clientTotals[" TOTAL"][0]),),
                 "%d (%2d%%)" % (len(clientData[1]), safePercent(len(clientData[1]), len(self.clientTotals[" TOTAL"][1])),),
@@ -905,6 +910,7 @@
 
         table.addFooter((
             "All",
+            "",
             "%d      " % (self.clientTotals[" TOTAL"][0],),
             "%d      " % (len(self.clientTotals[" TOTAL"][1]),),
             "%d      " % (len(self.clientTotals[" TOTAL"][2]),),
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20160526/e950363c/attachment.html>


More information about the calendarserver-changes mailing list