# HG changeset patch # User mpm@selenic.com # Date 1118440088 28800 # Node ID 61414da06fe5bb0af5c53a816d82232141d25fa9 # Parent 075619d00dd72c1218850d7facef9bdd01ee3696 add easy profiling support -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 add easy profiling support Now you can do hg -p [command] and it will run it under the hotshot profiler manifest hash: fcad346798243ad2434bc5458ed8d3456707c599 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCqgqYywK+sNU5EO8RAp9BAJsFI7iUWYEMvXWYaVt4VmrlOF3enwCdEFRJ l/EZmMLecbfQcbbh5oo0yHs= =voa0 -----END PGP SIGNATURE----- diff -r 075619d00dd7 -r 61414da06fe5 mercurial/commands.py --- a/mercurial/commands.py Fri Jun 10 12:49:25 2005 -0800 +++ b/mercurial/commands.py Fri Jun 10 13:48:08 2005 -0800 @@ -595,6 +595,7 @@ opts = [('v', 'verbose', None, 'verbose'), ('d', 'debug', None, 'debug'), ('q', 'quiet', None, 'quiet'), + ('p', 'profile', None, 'profile'), ('y', 'noninteractive', None, 'run non-interactively'), ] @@ -633,7 +634,18 @@ d = lambda: i[0](u, *args, **cmdoptions) try: - return d() + if options['profile']: + import hotshot, hotshot.stats + prof = hotshot.Profile("hg.prof") + r = prof.runcall(d) + prof.close() + stats = hotshot.stats.load("hg.prof") + stats.strip_dirs() + stats.sort_stats('time', 'calls') + stats.print_stats(40) + return r + else: + return d() except SignalInterrupt: u.warn("killed!\n") except KeyboardInterrupt: