[CalendarServer-changes] [6097] CalendarServer/trunk/contrib/performance
source_changes at macosforge.org
source_changes at macosforge.org
Tue Aug 17 16:25:38 PDT 2010
Revision: 6097
http://trac.macosforge.org/projects/calendarserver/changeset/6097
Author: exarkun at twistedmatrix.com
Date: 2010-08-17 16:25:34 -0700 (Tue, 17 Aug 2010)
Log Message:
-----------
Keep stats in parameterized bins; give the stat keys control over what report.py can do
Modified Paths:
--------------
CalendarServer/trunk/contrib/performance/benchmark.py
CalendarServer/trunk/contrib/performance/stats.py
Modified: CalendarServer/trunk/contrib/performance/benchmark.py
===================================================================
--- CalendarServer/trunk/contrib/performance/benchmark.py 2010-08-17 22:59:03 UTC (rev 6096)
+++ CalendarServer/trunk/contrib/performance/benchmark.py 2010-08-17 23:25:34 UTC (rev 6097)
@@ -187,11 +187,12 @@
for stat, survey, parameter in stuff:
print 'Surveying', stat
+ statistics[stat] = {}
for p in parameter:
print 'Parameter at', p
dtrace = DTraceCollector(pids)
data = yield survey(dtrace, p, 100)
- statistics[stat] = data
+ statistics[stat][p] = data
fObj = file(datetime.now().isoformat(), 'w')
dump(statistics, fObj, 2)
Modified: CalendarServer/trunk/contrib/performance/stats.py
===================================================================
--- CalendarServer/trunk/contrib/performance/stats.py 2010-08-17 22:59:03 UTC (rev 6096)
+++ CalendarServer/trunk/contrib/performance/stats.py 2010-08-17 23:25:34 UTC (rev 6097)
@@ -1,5 +1,7 @@
+NANO = 1000000000.0
+
def mean(samples):
return sum(samples) / len(samples)
@@ -15,6 +17,8 @@
class _Statistic(object):
+ commands = ['summarize']
+
def __init__(self, name):
self.name = name
@@ -39,6 +43,8 @@
class SQLDuration(_Statistic):
+ commands = ['summarize', 'statements']
+
def summarize(self, data):
statements = {}
intervals = []
@@ -50,9 +56,12 @@
return _Statistic.summarize(self, intervals)
+ def statements(self, data):
+ statements = {}
+ for (sql, interval) in data:
+ statements.setdefault(sql, []).append(interval)
+ for s in statements:
+ print sum(statements[s]) / NANO, 'seconds:', s
class Bytes(_Statistic):
pass
-
-
-
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100817/e991bbed/attachment-0001.html>
More information about the calendarserver-changes
mailing list