--- a/devtools/devctl.py Fri Mar 27 12:27:43 2009 +0100
+++ b/devtools/devctl.py Sun Mar 29 19:06:49 2009 +0200
@@ -513,17 +513,20 @@
raise BadCommandUsage("no argument expected")
import re
requests = {}
- for line in sys.stdin:
+ for lineno, line in enumerate(sys.stdin):
if not ' WHERE ' in line:
continue
#sys.stderr.write( line )
- rql, time = line.split('--')
- rql = re.sub("(\'\w+': \d*)", '', rql)
- req = requests.setdefault(rql, [])
- time.strip()
- chunks = time.split()
- cputime = float(chunks[-3])
- req.append( cputime )
+ try:
+ rql, time = line.split('--')
+ rql = re.sub("(\'\w+': \d*)", '', rql)
+ 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))
stat = []
for rql, times in requests.items():
@@ -531,8 +534,9 @@
stat.sort()
stat.reverse()
+ print 'Time ; Occurences ; Query'
for time, occ, rql in stat:
- print time, occ, rql
+ print time, ';', occ, ';', rql
register_commands((UpdateCubicWebCatalogCommand,
UpdateTemplateCatalogCommand,