devtools/devctl.py
branchstable
changeset 2092 f5102472243d
parent 1977 606923dff11b
child 2395 e3093fc12a00
child 2446 440cb4ea7e5c
--- a/devtools/devctl.py	Wed Jun 10 14:51:48 2009 +0200
+++ b/devtools/devctl.py	Wed Jun 10 16:13:29 2009 +0200
@@ -572,22 +572,25 @@
                 req = requests.setdefault(rql, [])
                 time.strip()
                 chunks = time.split()
+                clocktime = float(chunks[0][1:])
                 cputime = float(chunks[-3])
-                req.append( cputime )
+                req.append( (clocktime, cputime) )
             except Exception, exc:
                 sys.stderr.write('Line %s: %s (%s)\n' % (lineno, exc, line))
 
         stat = []
         for rql, times in requests.items():
-            stat.append( (sum(times), len(times), rql) )
+            stat.append( (sum(time[0] for time in times),
+                          sum(time[1] for time in times),
+                          len(times), rql) )
 
         stat.sort()
         stat.reverse()
 
-        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 '%.2f;%.2f;%s;%s' % (time/total_time, time, occ, rql)
+        total_time = sum(clocktime for clocktime, cputime, occ, rql in stat)*0.01
+        print 'Percentage;Cumulative Time (clock);Cumulative Time (CPU);Occurences;Query'
+        for clocktime, cputime, occ, rql in stat:
+            print '%.2f;%.2f;%.2f;%s;%s' % (clocktime/total_time, clocktime, cputime, occ, rql)
 
 register_commands((UpdateCubicWebCatalogCommand,
                    UpdateTemplateCatalogCommand,