[CalendarServer-changes] [7306] CalendarServer/trunk/contrib/performance/loadtest/ical.py
source_changes at macosforge.org
source_changes at macosforge.org
Fri Apr 8 14:06:23 PDT 2011
Revision: 7306
http://trac.macosforge.org/projects/calendarserver/changeset/7306
Author: exarkun at twistedmatrix.com
Date: 2011-04-08 14:06:22 -0700 (Fri, 08 Apr 2011)
Log Message:
-----------
Add more information to the RequestLogger output
Modified Paths:
--------------
CalendarServer/trunk/contrib/performance/loadtest/ical.py
Modified: CalendarServer/trunk/contrib/performance/loadtest/ical.py
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/ical.py 2011-04-08 19:49:58 UTC (rev 7305)
+++ CalendarServer/trunk/contrib/performance/loadtest/ical.py 2011-04-08 21:06:22 UTC (rev 7306)
@@ -19,6 +19,7 @@
from operator import getitem
from pprint import pformat
from datetime import datetime
+from urlparse import urlparse, urlunparse
from xml.etree import ElementTree
ElementTree.QName.__repr__ = lambda self: '<QName %r>' % (self.text,)
@@ -196,17 +197,14 @@
# not both.
after = self.reactor.seconds()
- # XXX If the response code is wrong, there's probably not
- # point passing the response down the callback chain.
- # errback?
success = response.code == expectedResponseCode
# if not success:
# import pdb; pdb.set_trace()
msg(
type="response", success=success, method=method,
- headers=headers, body=body,
- duration=(after - before), url=url)
+ headers=headers, body=body, code=response.code,
+ user=self.user, duration=(after - before), url=url)
if success:
return response
@@ -665,11 +663,17 @@
class RequestLogger(object):
+ format = "%(user)s request %(code)s [%(duration)0.2f ms] %(method)8s %(url)s"
def observe(self, event):
- if event.get("type") == "request":
- print event["user"], event["method"], event["url"]
+ if event.get("type") == "response":
+ event['url'] = urlunparse(('', '') + urlparse(event['url'])[2:])
+ print self.format % event
+ def report(self):
+ pass
+
+
def main():
from urllib2 import HTTPDigestAuthHandler
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110408/655b6e2c/attachment.html>
More information about the calendarserver-changes
mailing list