[CalendarServer-changes] [13770] CalendarServer/branches/users/gaya/groupsharee2
source_changes at macosforge.org
source_changes at macosforge.org
Thu Jul 17 11:54:14 PDT 2014
Revision: 13770
http://trac.calendarserver.org//changeset/13770
Author: gaya at apple.com
Date: 2014-07-17 11:54:14 -0700 (Thu, 17 Jul 2014)
Log Message:
-----------
merge in trunk to r13769
Revision Links:
--------------
http://trac.calendarserver.org//changeset/13769
Modified Paths:
--------------
CalendarServer/branches/users/gaya/groupsharee2/contrib/tools/statsanalysis.py
CalendarServer/branches/users/gaya/groupsharee2/twistedcaldav/stdconfig.py
Added Paths:
-----------
CalendarServer/branches/users/gaya/groupsharee2/contrib/tools/__init__.py
Copied: CalendarServer/branches/users/gaya/groupsharee2/contrib/tools/__init__.py (from rev 13769, CalendarServer/trunk/contrib/tools/__init__.py)
===================================================================
--- CalendarServer/branches/users/gaya/groupsharee2/contrib/tools/__init__.py (rev 0)
+++ CalendarServer/branches/users/gaya/groupsharee2/contrib/tools/__init__.py 2014-07-17 18:54:14 UTC (rev 13770)
@@ -0,0 +1,15 @@
+##
+# Copyright (c) 2014 Apple Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
Modified: CalendarServer/branches/users/gaya/groupsharee2/contrib/tools/statsanalysis.py
===================================================================
--- CalendarServer/branches/users/gaya/groupsharee2/contrib/tools/statsanalysis.py 2014-07-17 02:05:24 UTC (rev 13769)
+++ CalendarServer/branches/users/gaya/groupsharee2/contrib/tools/statsanalysis.py 2014-07-17 18:54:14 UTC (rev 13770)
@@ -1,6 +1,6 @@
#!/usr/bin/env python
##
-# Copyright (c) 2010-2014 Apple Inc. All rights reserved.
+# Copyright (c) 2014 Apple Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -24,19 +24,35 @@
dataset = {}
def analyze(fpath, title):
+ """
+ Analyze a readStats data file.
- print("Analyzing data for %s" % (fpath,))
+ @param fpath: path of file to analyze
+ @type fpath: L{str}
+ @param title: title to use for data set
+ @type title: L{str}
+ """
+
+ print("Analyzing data for %s" % (title,))
dataset[title] = {}
with open(fpath) as f:
for line in f:
if line.startswith("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"):
analyzeRecord(f, title)
- print("Stored %d data points" % (len(dataset[title]),))
+ print("Read %d data points\n" % (len(dataset[title]),))
def analyzeRecord(liter, title):
+ """
+ Analyze one entry from the readStats data file.
+ @param liter: iterator over lines in the file
+ @type liter: L{iter}
+ @param title: title to use for data set
+ @type title: L{str}
+ """
+
dt = liter.next()
time = dt[11:]
seconds = 60 * (60 * int(time[0:2]) + int(time[3:5])) + int(time[6:8])
@@ -49,8 +65,15 @@
dataset[title][seconds].update(methods)
break
+
def parseOverall(line):
+ """
+ Parse the "Overall:" stats summary line.
+ @param line: the line to parse
+ @type line: L{str}
+ """
+
splits = line.split("|")
overall = {}
keys = (
@@ -73,7 +96,13 @@
def parseMethods(liter):
+ """
+ Parse the "Method Count" table from a data file entry.
+ @param liter: iterator over lines in the file
+ @type liter: L{iter}
+ """
+
while liter.next()[1] != "-":
pass
@@ -97,17 +126,24 @@
def plotSeries(key, ymin=None, ymax=None):
+ """
+ Plot the chosen dataset key for each scanned data file.
+ @param key: data set key to use
+ @type key: L{str}
+ @param ymin: minimum value for y-axis or L{None} for default
+ @type ymin: L{int} or L{float}
+ @param ymax: maximum value for y-axis or L{None} for default
+ @type ymax: L{int} or L{float}
+ """
- color = iter(("b+", "r+", "g+",))
- for _ignore_title, data in sorted(dataset.items(), key=lambda x: x[0]):
- x1, y1 = zip(*[(k / 3600.0, v[key]) for k, v in sorted(data.items(), key=lambda x: x[0]) if key in v])
+ titles = []
+ for title, data in sorted(dataset.items(), key=lambda x: x[0]):
+ titles.append(title)
+ x, y = zip(*[(k / 3600.0, v[key]) for k, v in sorted(data.items(), key=lambda x: x[0]) if key in v])
- # print("".join(["{}\t{}\n".format(x, y) for x, y in zip(x1, y1)]))
-
- plt.plot(x1, y1, color.next())
+ plt.plot(x, y)
- #plt.legend((key,), 'upper left', shadow=True, fancybox=True)
plt.xlabel("Hours")
plt.ylabel(key)
plt.xlim(0, 24)
@@ -119,6 +155,7 @@
(1, 4, 7, 10, 13, 16, 19, 22,),
(18, 21, 0, 3, 6, 9, 12, 15,),
)
+ plt.legend(titles, 'upper left', shadow=True, fancybox=True)
plt.show()
@@ -161,6 +198,7 @@
pwd = os.getcwd()
+ # Scan data directory and read in data from each file found
fnames = os.listdir(scanDir)
count = 1
for name in fnames:
@@ -173,6 +211,8 @@
analyze(os.path.join(scanDir, name), trailer)
count += 1
+ # Build the set of data set keys that can be plotted and let the user
+ # choose which one
keys = set()
for data in dataset.values():
for items in data.values():
Modified: CalendarServer/branches/users/gaya/groupsharee2/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/branches/users/gaya/groupsharee2/twistedcaldav/stdconfig.py 2014-07-17 02:05:24 UTC (rev 13769)
+++ CalendarServer/branches/users/gaya/groupsharee2/twistedcaldav/stdconfig.py 2014-07-17 18:54:14 UTC (rev 13770)
@@ -1078,7 +1078,7 @@
},
"GroupAttendees" : {
- "Enabled": False,
+ "Enabled": True,
"ReconciliationDelaySeconds" : 5,
"UpdateOldEventLimitSeconds" : 1 * 24 * 60 * 60, # 1 day
},
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140717/a800b2c7/attachment-0001.html>
More information about the calendarserver-changes
mailing list