~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Ian Clatworthy
  • Date: 2007-05-28 02:08:25 UTC
  • mto: This revision was merged to the branch mainline in revision 2527.
  • Revision ID: ian.clatworthy@internode.on.net-20070528020825-ytop085jnocvmx3q
make profiling information easier to view and better documented

Show diffs side-by-side

added added

removed removed

Lines of Context:
540
540
    if filename is None:
541
541
        stats.pprint()
542
542
    else:
543
 
        stats.freeze()
544
 
        cPickle.dump(stats, open(filename, 'w'), 2)
 
543
        outfile = open(filename, 'w')
 
544
        if filename.endswith("grind"):
 
545
            stats.calltree(outfile)
 
546
        elif filename.endswith("txt"):
 
547
            stats.pprint(file=outfile)
 
548
        else:
 
549
            stats.freeze()
 
550
            cPickle.dump(stats, outfile, 2)
 
551
        outfile.close()
545
552
        print 'Profile data written to %r.' % filename
546
553
    return ret
547
554