##// END OF EJS Templates
add easy profiling support...
mpm@selenic.com -
r309:61414da0 default
parent child Browse files
Show More
@@ -595,6 +595,7 b' def dispatch(args):'
595 595 opts = [('v', 'verbose', None, 'verbose'),
596 596 ('d', 'debug', None, 'debug'),
597 597 ('q', 'quiet', None, 'quiet'),
598 ('p', 'profile', None, 'profile'),
598 599 ('y', 'noninteractive', None, 'run non-interactively'),
599 600 ]
600 601
@@ -633,6 +634,17 b' def dispatch(args):'
633 634 d = lambda: i[0](u, *args, **cmdoptions)
634 635
635 636 try:
637 if options['profile']:
638 import hotshot, hotshot.stats
639 prof = hotshot.Profile("hg.prof")
640 r = prof.runcall(d)
641 prof.close()
642 stats = hotshot.stats.load("hg.prof")
643 stats.strip_dirs()
644 stats.sort_stats('time', 'calls')
645 stats.print_stats(40)
646 return r
647 else:
636 648 return d()
637 649 except SignalInterrupt:
638 650 u.warn("killed!\n")
General Comments 0
You need to be logged in to leave comments. Login now