[CalendarServer-changes] [8670] CalendarServer/trunk/contrib/tools/request_monitor.py
source_changes at macosforge.org
source_changes at macosforge.org
Tue Feb 14 08:26:07 PST 2012
Revision: 8670
http://trac.macosforge.org/projects/calendarserver/changeset/8670
Author: cdaboo at apple.com
Date: 2012-02-14 08:26:07 -0800 (Tue, 14 Feb 2012)
Log Message:
-----------
Add option to control the number of longest requests shown.
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-02-14 01:22:55 UTC (rev 8669)
+++ CalendarServer/trunk/contrib/tools/request_monitor.py 2012-02-14 16:26:07 UTC (rev 8670)
@@ -218,6 +218,7 @@
print "--lines N specifies how many lines to tail from access.log (default: 10000)"
print "--range M:N specifies a range of lines to analyze from access.log (default: all)"
print "--procs N specifies how many python processes are expected in the log file (default: 80)"
+ print "--top N how many long requests to print (default: 10)"
print "--router analyze a partition server router node"
print "--worker analyze a partition server worker node"
print
@@ -225,10 +226,11 @@
numLines = 10000
numProcs = 80
+numTop = 10
lineRange = None
router = False
worker = False
-options, args = getopt.getopt(sys.argv[1:], "h", ["debug", "router", "worker", "lines=", "range=", "procs=",])
+options, args = getopt.getopt(sys.argv[1:], "h", ["debug", "router", "worker", "lines=", "range=", "procs=", "top="])
for option, value in options:
if option == "-h":
usage()
@@ -245,6 +247,8 @@
lineRange = (int(value.split(":")[0]), int(value.split(":")[1]))
elif option == "--procs":
numProcs = int(value)
+ elif option == "--top":
+ numTop = int(value)
if len(args):
filename = os.path.expanduser(args[0])
@@ -458,10 +462,10 @@
print
print
- print "Top 10 longest (in most recent %d requests):" % (numRequests,)
+ print "Top %d longest (in most recent %d requests):" % (numTop, numRequests,)
requests.sort()
requests.reverse()
- for i in xrange(10):
+ for i in xrange(numTop):
try:
respTime, userId, method, kb, ext, client, logId, logTime, reqStartTime = requests[i]
"""
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120214/6b581c48/attachment.html>
More information about the calendarserver-changes
mailing list