[CalendarServer-changes] [11833] CalendarServer/branches/users/cdaboo/performance-tweaks/contrib/ tools/protocolanalysis.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Mar 12 11:18:53 PDT 2014


Revision: 11833
          http://trac.calendarserver.org//changeset/11833
Author:   cdaboo at apple.com
Date:     2013-10-28 10:20:30 -0700 (Mon, 28 Oct 2013)
Log Message:
-----------
Add per-user data analysis to help get numbers for the sim.

Modified Paths:
--------------
    CalendarServer/branches/users/cdaboo/performance-tweaks/contrib/tools/protocolanalysis.py

Modified: CalendarServer/branches/users/cdaboo/performance-tweaks/contrib/tools/protocolanalysis.py
===================================================================
--- CalendarServer/branches/users/cdaboo/performance-tweaks/contrib/tools/protocolanalysis.py	2013-10-23 00:24:49 UTC (rev 11832)
+++ CalendarServer/branches/users/cdaboo/performance-tweaks/contrib/tools/protocolanalysis.py	2013-10-28 17:20:30 UTC (rev 11833)
@@ -293,6 +293,12 @@
         self.userCounts = collections.defaultdict(int)
         self.userResponseTimes = collections.defaultdict(float)
 
+        self.newEvents = 0
+        self.newInvites = 0
+        self.updateEvents = 0
+        self.updateInvites = 0
+        self.attendeeInvites = 0
+
         self.otherUserCalendarRequests = {}
 
         self.currentLine = None
@@ -416,6 +422,19 @@
                 self.hourlyByStatus[" TOTAL"][timeBucketIndex] += 1
                 self.hourlyByStatus[self.currentLine.status][timeBucketIndex] += 1
 
+                if self.currentLine.status == 201:
+                    if adjustedMethod == METHOD_PUT_ICS:
+                        self.newEvents += 1
+                    elif adjustedMethod == METHOD_PUT_ORGANIZER:
+                        self.newInvites += 1
+                elif isOK:
+                    if adjustedMethod == METHOD_PUT_ICS:
+                        self.updateEvents += 1
+                    elif adjustedMethod == METHOD_PUT_ORGANIZER:
+                        self.updateInvites += 1
+                    elif adjustedMethod == METHOD_PUT_ATTENDEE:
+                        self.attendeeInvites += 1
+
                 # Cache analysis
                 if adjustedMethod == METHOD_PROPFIND_CALENDAR and self.currentLine.status == 207:
                     responses = int(self.currentLine.extended.get("responses", 0))
@@ -1029,7 +1048,10 @@
             #print("User Response times")
             #self.printUserResponseTimes(doTabs)
 
+            print("Sim values")
+            self.printSimStats(doTabs)
 
+
     def printInfo(self, doTabs):
 
         table = tables.Table()
@@ -1083,6 +1105,7 @@
         totalRequests = 0
         totalDepth = 0
         totalTime = 0.0
+        self.timeCounts = 0
         for ctr in xrange(self.timeBucketCount):
             hour = self.getHourFromIndex(ctr)
             if hour is None:
@@ -1101,12 +1124,13 @@
             totalRequests += countRequests
             totalDepth += countDepth
             totalTime += countTime
+            self.timeCounts += 1
 
         table.addFooter(
             (
                 "Total:",
                 totalRequests,
-                (1.0 * totalRequests) / self.timeBucketCount / self.resolutionMinutes / 60,
+                safePercent(totalRequests, self.timeCounts * self.resolutionMinutes * 60, 1.0),
                 safePercent(totalTime, totalRequests, 1.0),
                 safePercent(float(totalDepth), totalRequests, 1),
             ),
@@ -1545,7 +1569,38 @@
         print("")
 
 
+    def printSimStats(self, doTabs):
+        users = len(self.userCounts.keys())
+        hours = self.timeCounts / self.resolutionMinutes / 60
+        table = tables.Table()
+        table.setDefaultColumnFormats((
+                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),
+                tables.Table.ColumnFormat("%s", tables.Table.ColumnFormat.RIGHT_JUSTIFY),
+                ))
+        table.addHeader(("Item", "Value", "Items, per User, per Day", "Interval (sec), per item, per user"))
+        table.addRow(("Unique Users", users, "", ""))
 
+        def _addRow(title, item):
+            table.addRow((title, item, "%.1f" % (safePercent(24 * item, hours * users, 1.0),), "%.1f" % (safePercent(hours * 60 * 60 * users, item, 1.0),),))
+
+        _addRow("New Events", self.newEvents)
+        _addRow("New Invites", self.newInvites)
+        _addRow("Updated Events", self.updateEvents)
+        _addRow("Updated Invites", self.updateInvites)
+        _addRow("Attendee Invites", self.attendeeInvites)
+        table.addRow((
+            "Recipients",
+            "%.1f" % (safePercent(sum(self.averagedHourlyByRecipientCount["iTIP Average"]), self.timeCounts, 1.0),),
+            "",
+            "",
+        ))
+        table.printTabDelimitedData() if doTabs else table.printTable()
+        print("")
+
+
+
 class TablePrinter(object):
 
     @classmethod
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/f060b2a5/attachment.html>


More information about the calendarserver-changes mailing list