4 gather_profile_stats.py /path/to/dir/of/profiles
6 Note that the aggregated profiles must be read with pstats.Stats, not
7 hotshot.stats (the formats are incompatible)
10 from hotshot
import stats
16 for f
in os
.listdir(p
):
17 if f
.endswith('.agg.prof'):
19 prof
= pstats
.Stats(os
.path
.join(p
, f
))
20 elif f
.endswith('.prof'):
22 path
= ".".join(bits
[:-3])
23 prof
= stats
.load(os
.path
.join(p
, f
))
26 print "Processing %s" % f
28 profiles
[path
].add(prof
)
31 os
.unlink(os
.path
.join(p
, f
))
32 for (path
, prof
) in profiles
.items():
33 prof
.dump_stats(os
.path
.join(p
, "%s.agg.prof" % path
))
35 if __name__
== '__main__':
36 gather_stats(sys
.argv
[1])