~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: mbp at sourcefrog
  • Date: 2005-04-11 02:50:08 UTC
  • Revision ID: mbp@sourcefrog.net-20050411025008-855e0e0637ff8a49
- Don't put profiling temp file in current directory

Show diffs side-by-side

added added

removed removed

Lines of Context:
986
986
 
987
987
    if profile:
988
988
        import hotshot
989
 
        prof = hotshot.Profile('.bzr.profile')
 
989
        pfname = tempfile.mkstemp()[1]
 
990
        prof = hotshot.Profile(pfname)
990
991
        ret = prof.runcall(cmd_handler, **cmdargs) or 0
991
992
        prof.close()
992
993
 
993
994
        import hotshot.stats
994
 
        stats = hotshot.stats.load('.bzr.profile')
 
995
        stats = hotshot.stats.load(pfname)
995
996
        #stats.strip_dirs()
996
997
        stats.sort_stats('time')
 
998
        ## XXX: Might like to write to stderr or the trace file instead but
 
999
        ## print_stats seems hardcoded to stdout
997
1000
        stats.print_stats(20)
998
1001
 
999
1002
        return ret