viff

changeset 1173:8d439efb4a90

Replace hotspot by cProfile for profiling.
author Marcel Keller <mkeller@cs.au.dk>
date Fri, 24 Apr 2009 14:00:00 +0200
parents 421a199020e9
children ade6aff2dde2
files viff/runtime.py
diffstat 1 files changed, 4 insertions(+), 8 deletions(-) [+]
line diff
     1.1 --- a/viff/runtime.py	Wed Apr 15 11:30:07 2009 +0200
     1.2 +++ b/viff/runtime.py	Fri Apr 24 14:00:00 2009 +0200
     1.3 @@ -817,19 +817,15 @@
     1.4          # profiler here and stop it upon shutdown, but this triggers
     1.5          # http://bugs.python.org/issue1375 since the start and stop
     1.6          # calls are in different stack frames.
     1.7 -        import hotshot
     1.8 -        prof = hotshot.Profile("player-%d.prof" % id)
     1.9 +        import cProfile
    1.10 +        prof = cProfile.Profile()
    1.11          old_run = reactor.run
    1.12          def new_run(*args, **kwargs):
    1.13              print "Starting reactor with profiling"
    1.14              prof.runcall(old_run, *args, **kwargs)
    1.15  
    1.16 -            import sys
    1.17 -            import hotshot.stats
    1.18 -            print "Loading profiling statistics...",
    1.19 -            sys.stdout.flush()
    1.20 -            stats = hotshot.stats.load("player-%d.prof" % id)
    1.21 -            print "done."
    1.22 +            import pstats
    1.23 +            stats = pstats.Stats(prof)
    1.24              print
    1.25              stats.strip_dirs()
    1.26              stats.sort_stats("time", "calls")