Mercurial > hg
comparison mercurial/dispatch.py @ 8021:1c2cf2e5dc9b
profiling: dropping hotshot profiling. --profile as a unique profiling option
hotshot was an experimental module, which is broken for Python < 2.5
And even for Python >= 2.5 users, hotshot usage is discouraged: cProfile
(formerly lsprof) should be used instead.
author | Nicolas Dumazet <nicdumz.commits@gmail.com> |
---|---|
date | Wed, 08 Apr 2009 14:18:20 +0200 |
parents | de377b1a9a84 |
children | 4f3fdfaa3874 |
comparison
equal
deleted
inserted
replaced
8020:777a9efdae2d | 8021:1c2cf2e5dc9b |
---|---|
377 return cmdfunc() | 377 return cmdfunc() |
378 except error.SignatureError: | 378 except error.SignatureError: |
379 raise error.ParseError(cmd, _("invalid arguments")) | 379 raise error.ParseError(cmd, _("invalid arguments")) |
380 | 380 |
381 if options['profile']: | 381 if options['profile']: |
382 import hotshot, hotshot.stats | |
383 prof = hotshot.Profile("hg.prof") | |
384 try: | |
385 try: | |
386 return prof.runcall(checkargs) | |
387 except: | |
388 try: | |
389 ui.warn(_('exception raised - generating ' | |
390 'profile anyway\n')) | |
391 except: | |
392 pass | |
393 raise | |
394 finally: | |
395 prof.close() | |
396 stats = hotshot.stats.load("hg.prof") | |
397 stats.strip_dirs() | |
398 stats.sort_stats('time', 'calls') | |
399 stats.print_stats(40) | |
400 elif options['lsprof']: | |
401 try: | 382 try: |
402 from mercurial import lsprof | 383 from mercurial import lsprof |
403 except ImportError: | 384 except ImportError: |
404 raise util.Abort(_( | 385 raise util.Abort(_( |
405 'lsprof not available - install from ' | 386 'lsprof not available - install from ' |