--- a/devtools/devctl.py Sun Mar 29 19:06:49 2009 +0200
+++ b/devtools/devctl.py Mon Mar 30 01:09:16 2009 +0200
@@ -520,13 +520,15 @@
try:
rql, time = line.split('--')
rql = re.sub("(\'\w+': \d*)", '', rql)
+ if '{' in rql:
+ rql = rql[:rql.index('{')]
req = requests.setdefault(rql, [])
time.strip()
chunks = time.split()
cputime = float(chunks[-3])
req.append( cputime )
except Exception, exc:
- sys.stderr.write('Line %s: %s\n' % (lineno, exc))
+ sys.stderr.write('Line %s: %s (%s)\n' % (lineno, exc, line))
stat = []
for rql, times in requests.items():
@@ -534,9 +536,11 @@
stat.sort()
stat.reverse()
- print 'Time ; Occurences ; Query'
+
+ total_time = sum(time for time, occ, rql in stat)*0.01
+ print 'Percentage;Cumulative Time;Occurences;Query'
for time, occ, rql in stat:
- print time, ';', occ, ';', rql
+ print '%.2f;%.2f;%s;%s' % (time/total_time, time, occ, rql)
register_commands((UpdateCubicWebCatalogCommand,
UpdateTemplateCatalogCommand,