2007-01-18 Don Allingham <don@gramps-project.org>
* src/DataViews/Utils.py: add profile function svn: r7931
This commit is contained in:
parent
c0f9fcb160
commit
b24c75398a
@ -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.
|
||||
|
||||
|
@ -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