Mercurial > public > mercurial-scm > hg-stable
diff mercurial/dispatch.py @ 8024:9a1b86cfd29e
profiling: Adding support for kcachegrind output format, using lsprofcalltree
author | Nicolas Dumazet <nicdumz.commits@gmail.com> |
---|---|
date | Wed, 08 Apr 2009 14:20:57 +0200 |
parents | fd9debb3ea1b |
children | 6b5522cb2ad2 |
line wrap: on
line diff
--- a/mercurial/dispatch.py Thu Apr 02 16:01:30 2009 +0900 +++ b/mercurial/dispatch.py Wed Apr 08 14:20:57 2009 +0200 @@ -381,7 +381,7 @@ if options['profile']: format = ui.config('profiling', 'format', default='text') - if not format in ['text']: + if not format in ['text', 'kcachegrind']: ui.warn(_("unrecognized profiling format '%s'" " - Ignored\n") % format) format = 'text' @@ -407,9 +407,16 @@ return checkargs() finally: p.disable() - stats = lsprof.Stats(p.getstats()) - stats.sort() - stats.pprint(top=10, file=ostream, climit=5) + + if format == 'kcachegrind': + import lsprofcalltree + calltree = lsprofcalltree.KCacheGrind(p) + calltree.output(ostream) + else: + # format == 'text' + stats = lsprof.Stats(p.getstats()) + stats.sort() + stats.pprint(top=10, file=ostream, climit=5) if output: ostream.close()