Updated German translation
[banshee.git] / extras / perf-analyze-log
blob0b0e5d6449289171d81b0d558b82b061ddc0a136
1 #!/usr/bin/env python
3 import sys
4 import re
6 times = {}
7 grand_total = 0
9 for line in open (sys.argv[1]):
10 match = re.match ('^\[.+\] (.+) service started \((\w+), ([0-9\.]+)s\)',
11 line.rstrip ('\r\n'))
12 if match:
13 type = match.group (1)
14 if type not in times:
15 times[type] = []
16 times[type].append ((match.group (2), float (match.group (3))))
18 for k, v in times.iteritems ():
19 set_total = 0
20 print '%s Services:\n' % k
21 v.sort (lambda a, b: -cmp (a[1], b[1]))
22 for service, time in v:
23 set_total = set_total + time
24 print '\t%.8f\t%s' % (time, service)
25 print '\t----------\t-----'
26 print '\t%.8f\tTotal\n' % set_total
27 grand_total = grand_total + set_total
29 print '\n\t%.8f\tGrand Total' % grand_total