# HG changeset patch # User Nicolas Chauvat # Date 1238368156 -7200 # Node ID 8a075bc94563220eb8f4d67477e0063e02ece094 # Parent 6937dfb242fb89cd8d473a5a824f9535c59806d7 [devtools] improve output of exlog command diff -r 6937dfb242fb -r 8a075bc94563 devtools/devctl.py --- 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,