comparison procprofile.py @ 116:60906f8803ef

Improved profiling
author Mike Pavone <pavone@retrodev.com>
date Wed, 13 Oct 2010 02:51:56 -0400
parents fd23ab2c1a73
children
comparison
equal deleted inserted replaced
115:04148770c229 116:60906f8803ef
25 for line in data: 25 for line in data:
26 funcid,_,rest = line[len('Func: '):].partition('\tCount: ') 26 funcid,_,rest = line[len('Func: '):].partition('\tCount: ')
27 count,_,rest = rest.partition('\tTime: ') 27 count,_,rest = rest.partition('\tTime: ')
28 total,_,rest = rest.partition('\tAvg: ') 28 total,_,rest = rest.partition('\tAvg: ')
29 avg,_,rest = rest.partition('\tSelf: ') 29 avg,_,rest = rest.partition('\tSelf: ')
30 self,_,selfavg = rest.partition('\tAvg: ') 30 self,_,rest = rest.partition('\tAvg: ')
31 records.append((names[int(funcid)], int(count), int(total), float(avg), int(self), float(selfavg))) 31 selfavg,_,nestcount = rest.partition('\tNested Count: ')
32 records.append((names[int(funcid)], int(count), int(total), float(avg), int(self), float(selfavg), int(nestcount)))
32 33
33 34
34 records.sort(key=lambda el: el[3]) 35 records.sort(key=lambda el: el[3])
35 36
36 print 'Func\tCount\tTotal(us)\tAvg(us)\tSelf(us)\tSelf Avg(us)' 37 print 'Func\tCount\tTotal(us)\tAvg(us)\tSelf(us)\tSelf Avg(us)'
37 for record in records: 38 for record in records:
38 print '%s\t%d\t%d\t%f\t%d\t%f' % record 39 print '%s\t%d\t%d\t%f\t%d\t%f\t%d' % record
39 40
40 41
41 42