2007-01-18 Don Allingham <don@gramps-project.org>
* src/DataViews/Utils.py: add profile function svn: r7931
This commit is contained in:
parent
c965f773f3
commit
1a674f00be
@ -1,3 +1,6 @@
|
||||
2007-01-18 Don Allingham <don@gramps-project.org>
|
||||
* src/DataViews/Utils.py: add profile function
|
||||
|
||||
2007-01-18 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
|
||||
* src/NameDisplay.py: yet more optimisations for name display.
|
||||
|
||||
|
15
src/Utils.py
15
src/Utils.py
@ -1076,3 +1076,18 @@ def launch(prog_str,path):
|
||||
|
||||
os.spawnvpe(os.P_NOWAIT, prog, prog_list, os.environ)
|
||||
|
||||
def profile(func):
|
||||
import hotshot, hotshot.stats
|
||||
|
||||
pr = hotshot.Profile('mystats.profile')
|
||||
print "Start"
|
||||
pr.runcall(func)
|
||||
print "Finished"
|
||||
pr.close()
|
||||
print "Loading profile"
|
||||
stats = hotshot.stats.load('mystats.profile')
|
||||
print "done"
|
||||
stats.strip_dirs()
|
||||
stats.sort_stats('time','calls')
|
||||
stats.print_stats(100)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user