annotate light8/profilereport.py @ 158:5c7ac46e33d3

more disabling of stuff that make no sense at certain times and some more disabling of stuff that make no sense at certain times and some bug fixes. still haven't fixed the scale problem
author dmcc
date Mon, 07 Jul 2003 07:39:40 +0000
parents 45b12307c695
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
1 """
45b12307c695 Initial revision
drewp
parents:
diff changeset
2 tweak rsn.py to run the profile module, and write the output to files
45b12307c695 Initial revision
drewp
parents:
diff changeset
3 in profile/ with names that describe how you exercised the
45b12307c695 Initial revision
drewp
parents:
diff changeset
4 program. then run this program to make files in profile/html/ for
45b12307c695 Initial revision
drewp
parents:
diff changeset
5 easier viewing.
45b12307c695 Initial revision
drewp
parents:
diff changeset
6 """
45b12307c695 Initial revision
drewp
parents:
diff changeset
7
45b12307c695 Initial revision
drewp
parents:
diff changeset
8 import pstats,glob,os,time,sys
45b12307c695 Initial revision
drewp
parents:
diff changeset
9
45b12307c695 Initial revision
drewp
parents:
diff changeset
10 allfiles = glob.glob("profile/*")
45b12307c695 Initial revision
drewp
parents:
diff changeset
11 allfiles.remove('profile/html')
45b12307c695 Initial revision
drewp
parents:
diff changeset
12 allfiles.sort()
45b12307c695 Initial revision
drewp
parents:
diff changeset
13
45b12307c695 Initial revision
drewp
parents:
diff changeset
14 header = "profile output from %s<p>" % (time.ctime())
45b12307c695 Initial revision
drewp
parents:
diff changeset
15 for f in allfiles:
45b12307c695 Initial revision
drewp
parents:
diff changeset
16 f=f[8:]
45b12307c695 Initial revision
drewp
parents:
diff changeset
17 header = header+"<a href=%(f)s.html>%(f)s</a> | " % locals()
45b12307c695 Initial revision
drewp
parents:
diff changeset
18
45b12307c695 Initial revision
drewp
parents:
diff changeset
19 for profileoutput in allfiles:
45b12307c695 Initial revision
drewp
parents:
diff changeset
20
45b12307c695 Initial revision
drewp
parents:
diff changeset
21
45b12307c695 Initial revision
drewp
parents:
diff changeset
22
45b12307c695 Initial revision
drewp
parents:
diff changeset
23 s=pstats.Stats(profileoutput)
45b12307c695 Initial revision
drewp
parents:
diff changeset
24
45b12307c695 Initial revision
drewp
parents:
diff changeset
25 f=open("profile/html/%s.html" % profileoutput[8:],'w')
45b12307c695 Initial revision
drewp
parents:
diff changeset
26 sys.stdout=f
45b12307c695 Initial revision
drewp
parents:
diff changeset
27 print header,"<pre>"
45b12307c695 Initial revision
drewp
parents:
diff changeset
28 s.sort_stats('cumulative').print_stats(15).print_callers(15)
45b12307c695 Initial revision
drewp
parents:
diff changeset
29 print "</pre>"
45b12307c695 Initial revision
drewp
parents:
diff changeset
30