[CalendarServer-changes] [9523] CalendarServer/trunk/contrib/tools/request_monitor.py
source_changes at macosforge.org
source_changes at macosforge.org
Fri Aug 3 10:38:10 PDT 2012
Revision: 9523
http://trac.macosforge.org/projects/calendarserver/changeset/9523
Author: cdaboo at apple.com
Date: 2012-08-03 10:38:10 -0700 (Fri, 03 Aug 2012)
Log Message:
-----------
Support new timing break-downs in log.
Modified Paths:
--------------
CalendarServer/trunk/contrib/tools/request_monitor.py
Modified: CalendarServer/trunk/contrib/tools/request_monitor.py
===================================================================
--- CalendarServer/trunk/contrib/tools/request_monitor.py 2012-08-03 17:37:18 UTC (rev 9522)
+++ CalendarServer/trunk/contrib/tools/request_monitor.py 2012-08-03 17:38:10 UTC (rev 9523)
@@ -354,14 +354,17 @@
numProxied = collections.defaultdict(int)
slotCount = collections.defaultdict(int)
totalRespTime = collections.defaultdict(float)
+ totalRespWithoutWRTime = collections.defaultdict(float)
maxRespTime = collections.defaultdict(float)
- under10ms = 0
- over10ms = 0
- over100ms = 0
- over1s = 0
- over10s = 0
- over30s = 0
- over60s = 0
+ under10ms = [0, 0]
+ over10ms = [0, 0]
+ over100ms = [0, 0]
+ over1s = [0, 0]
+ over10s = [0, 0]
+ over30s = [0, 0]
+ over60s = [0, 0]
+ totalOver1s = [0, 0]
+ totalOver10s = [0, 0]
requests = []
users = { }
startTime = None
@@ -414,26 +417,33 @@
slotCount[filename] += outstanding
respTime = float(extended['t'])
+ wrTime = float(extended.get('t-resp-wr', 0.0))
timeSpent = timesSpent.get(logId, 0.0) + respTime
timesSpent[logId] = timeSpent
totalRespTime[filename] += respTime
+ totalRespWithoutWRTime[filename] += respTime - wrTime
if respTime > maxRespTime[filename]:
maxRespTime[filename] = respTime
- if respTime >= 60000.0:
- over60s += 1
- elif respTime >= 30000.0:
- over30s +=1
- elif respTime >= 10000.0:
- over10s +=1
- elif respTime >= 1000.0:
- over1s +=1
- elif respTime >= 100.0:
- over100ms +=1
- elif respTime >= 10.0:
- over10ms +=1
- else:
- under10ms +=1
+ for index, testTime in enumerate((respTime, respTime - wrTime,)):
+ if testTime >= 60000.0:
+ over60s[index] += 1
+ elif testTime >= 30000.0:
+ over30s[index] +=1
+ elif testTime >= 10000.0:
+ over10s[index] +=1
+ elif testTime >= 1000.0:
+ over1s[index] +=1
+ elif testTime >= 100.0:
+ over100ms[index] +=1
+ elif testTime >= 10.0:
+ over10ms[index] +=1
+ else:
+ under10ms[index] +=1
+ if testTime >= 1000.0:
+ totalOver1s[index] +=1
+ if testTime >= 10000.0:
+ totalOver10s[index] +=1
ext = []
@@ -486,10 +496,10 @@
table = tables.Table()
table.addHeader(
- ("Instance", "Requests", "Av. Requests", "Av. Response", "Max. Response", "Slot", "Start", "End", "File Name"),
+ ("Instance", "Requests", "Av. Requests", "Av. Response", "Av. Response", "Max. Response", "Slot", "Start", "End", "File Name"),
)
table.addHeader(
- ( "", "", "per second", "(ms)", "(ms)", "Average", "Time", "Time", ""),
+ ( "", "", "per second", "(ms)", "no write(ms)", "(ms)", "Average", "Time", "Time", ""),
)
table.setDefaultColumnFormats(
(
@@ -498,6 +508,7 @@
tables.Table.ColumnFormat("%.1f", tables.Table.ColumnFormat.RIGHT_JUSTIFY),
tables.Table.ColumnFormat("%.1f", tables.Table.ColumnFormat.RIGHT_JUSTIFY),
tables.Table.ColumnFormat("%.1f", tables.Table.ColumnFormat.RIGHT_JUSTIFY),
+ tables.Table.ColumnFormat("%.1f", tables.Table.ColumnFormat.RIGHT_JUSTIFY),
tables.Table.ColumnFormat("%.2f", tables.Table.ColumnFormat.RIGHT_JUSTIFY),
tables.Table.ColumnFormat("%s", tables.Table.ColumnFormat.RIGHT_JUSTIFY),
tables.Table.ColumnFormat("%s", tables.Table.ColumnFormat.RIGHT_JUSTIFY),
@@ -507,6 +518,7 @@
totalAverage = 0.0
totalResponseTime = 0.0
+ totalResponseWithoutWRTime = 0.0
maxResponseTime = 0.0
totalSlots = 0
minStartTime = None
@@ -528,6 +540,9 @@
avgResponse = totalRespTime[filename] / len(times)
totalResponseTime += totalRespTime[filename]
+ avgResponseWithWR = totalRespWithoutWRTime[filename] / len(times)
+ totalResponseWithoutWRTime += totalRespWithoutWRTime[filename]
+
maxResponseTime = max(maxResponseTime, maxRespTime[filename])
totalSlots += slotCount[filename]
@@ -537,6 +552,7 @@
len(times),
avgRequests,
avgResponse,
+ avgResponseWithWR,
maxRespTime[filename],
float(slotCount[filename]) / len(times),
startTime,
@@ -550,6 +566,7 @@
totalRequests,
totalAverage,
totalResponseTime / totalRequests,
+ totalResponseWithoutWRTime / totalRequests,
maxResponseTime,
float(totalSlots) / totalRequests,
minStartTime,
@@ -567,7 +584,41 @@
lqlatency[0],
lqlatency[1],
)
- print "<10ms: %d >10ms: %d >100ms: %d >1s: %d >10s: %d >30s: %d >60s: %d" % (under10ms, over10ms, over100ms, over1s, over10s, over30s, over60s)
+
+ table = tables.Table()
+ table.addHeader(
+ ("", "<10ms", "10ms<->100ms", "100ms<->1s", "1s<->10s", "10s<->30s", "30s<->60s", ">60s", "Over 1s", "Over 10s"),
+ )
+ table.setDefaultColumnFormats(
+ (
+ tables.Table.ColumnFormat("%s", tables.Table.ColumnFormat.CENTER_JUSTIFY),
+ tables.Table.ColumnFormat("%d (%.1f%%)", tables.Table.ColumnFormat.RIGHT_JUSTIFY),
+ tables.Table.ColumnFormat("%d (%.1f%%)", tables.Table.ColumnFormat.RIGHT_JUSTIFY),
+ tables.Table.ColumnFormat("%d (%.1f%%)", tables.Table.ColumnFormat.RIGHT_JUSTIFY),
+ tables.Table.ColumnFormat("%d (%.1f%%)", tables.Table.ColumnFormat.RIGHT_JUSTIFY),
+ tables.Table.ColumnFormat("%d (%.1f%%)", tables.Table.ColumnFormat.RIGHT_JUSTIFY),
+ tables.Table.ColumnFormat("%d (%.1f%%)", tables.Table.ColumnFormat.RIGHT_JUSTIFY),
+ tables.Table.ColumnFormat("%d (%.1f%%)", tables.Table.ColumnFormat.RIGHT_JUSTIFY),
+ tables.Table.ColumnFormat("%.1f%%", tables.Table.ColumnFormat.RIGHT_JUSTIFY),
+ tables.Table.ColumnFormat("%.1f%%", tables.Table.ColumnFormat.RIGHT_JUSTIFY),
+ )
+ )
+ for i in xrange(2):
+ table.addRow((
+ "Overall Response" if i == 0 else "Response without Write",
+ (under10ms[i], safePercent(under10ms[i], totalRequests)),
+ (over10ms[i], safePercent(over10ms[i], totalRequests)),
+ (over100ms[i], safePercent(over100ms[i], totalRequests)),
+ (over1s[i], safePercent(over1s[i], totalRequests)),
+ (over10s[i], safePercent(over10s[i], totalRequests)),
+ (over30s[i], safePercent(over30s[i], totalRequests)),
+ (over60s[i], safePercent(over60s[i], totalRequests)),
+ safePercent(totalOver1s[i], totalRequests),
+ safePercent(totalOver10s[i], totalRequests),
+ ))
+ os = StringIO()
+ table.printTable(os=os)
+ print os.getvalue()
print
if errorCount:
print "Number of 500 errors: %d" % (errorCount,)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120803/e0238124/attachment-0001.html>
More information about the calendarserver-changes
mailing list