##// END OF EJS Templates
dispatch: start profiling earlier...
Bryan O'Sullivan -
r30934:6d642ecf default
parent child Browse files
Show More
@@ -668,6 +668,7 b' def _dispatch(req):'
668 for ui_ in uis:
668 for ui_ in uis:
669 ui_.setconfig('profiling', 'enabled', 'true', '--profile')
669 ui_.setconfig('profiling', 'enabled', 'true', '--profile')
670
670
671 with profiling.maybeprofile(lui):
671 # Configure extensions in phases: uisetup, extsetup, cmdtable, and
672 # Configure extensions in phases: uisetup, extsetup, cmdtable, and
672 # reposetup. Programs like TortoiseHg will call _dispatch several
673 # reposetup. Programs like TortoiseHg will call _dispatch several
673 # times so we keep track of configured extensions in _loaded.
674 # times so we keep track of configured extensions in _loaded.
@@ -693,7 +694,6 b' def _dispatch(req):'
693 # Check abbreviation/ambiguity of shell alias.
694 # Check abbreviation/ambiguity of shell alias.
694 shellaliasfn = _checkshellalias(lui, ui, args)
695 shellaliasfn = _checkshellalias(lui, ui, args)
695 if shellaliasfn:
696 if shellaliasfn:
696 with profiling.maybeprofile(lui):
697 return shellaliasfn()
697 return shellaliasfn()
698
698
699 # check for fallback encoding
699 # check for fallback encoding
@@ -710,8 +710,8 b' def _dispatch(req):'
710 raise error.Abort(_("option --cwd may not be abbreviated!"))
710 raise error.Abort(_("option --cwd may not be abbreviated!"))
711 if options["repository"]:
711 if options["repository"]:
712 raise error.Abort(_(
712 raise error.Abort(_(
713 "option -R has to be separated from other options (e.g. not -qR) "
713 "option -R has to be separated from other options (e.g. not "
714 "and --repository may only be abbreviated as --repo!"))
714 "-qR) and --repository may only be abbreviated as --repo!"))
715
715
716 if options["encoding"]:
716 if options["encoding"]:
717 encoding.encoding = options["encoding"]
717 encoding.encoding = options["encoding"]
@@ -720,13 +720,15 b' def _dispatch(req):'
720 if options["time"]:
720 if options["time"]:
721 def get_times():
721 def get_times():
722 t = os.times()
722 t = os.times()
723 if t[4] == 0.0: # Windows leaves this as zero, so use time.clock()
723 if t[4] == 0.0:
724 # Windows leaves this as zero, so use time.clock()
724 t = (t[0], t[1], t[2], t[3], time.clock())
725 t = (t[0], t[1], t[2], t[3], time.clock())
725 return t
726 return t
726 s = get_times()
727 s = get_times()
727 def print_time():
728 def print_time():
728 t = get_times()
729 t = get_times()
729 ui.warn(_("time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n") %
730 ui.warn(
731 _("time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n") %
730 (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3]))
732 (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3]))
731 atexit.register(print_time)
733 atexit.register(print_time)
732
734
@@ -755,7 +757,6 b' def _dispatch(req):'
755 elif not cmd:
757 elif not cmd:
756 return commands.help_(ui, 'shortlist')
758 return commands.help_(ui, 'shortlist')
757
759
758 with profiling.maybeprofile(lui):
759 repo = None
760 repo = None
760 cmdpats = args[:]
761 cmdpats = args[:]
761 if not func.norepo:
762 if not func.norepo:
General Comments 0
You need to be logged in to leave comments. Login now