[PATCH 1 of 6 v2] ui: provide a mechanism to track and log blocked time

Bryan O'Sullivan bos at serpentine.com
Thu Feb 9 19:06:53 EST 2017


On Thu, Feb 9, 2017 at 1:52 PM, Simon Farnsworth <simonfar at fb.com> wrote:

>
> diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
> --- a/mercurial/dispatch.py
> +++ b/mercurial/dispatch.py
> @@ -17,6 +17,7 @@
>  import signal
>  import sys
>  import time
> +import timeit
>  import traceback
>
>
> @@ -123,7 +124,7 @@
>          return -1
>
>      msg = ' '.join(' ' in a and repr(a) or a for a in req.args)
> -    starttime = time.time()
> +    starttime = timeit.default_timer()
>      ret = None
>      try:
>          ret = _runcatch(req)
> @@ -135,8 +136,11 @@
>                  raise
>          ret = -1
>      finally:
> -        duration = time.time() - starttime
> +        duration = timeit.default_timer() - starttime
>

(This is a good change, but should be in a separate patch...)

             self.httppasswordmgrdb = urlreq.httppasswordmgrwithdefaultreal
> m()
> +            self._blockedtimes = {}
>

self._blockedtimes = collections.defaultdict(lambda: 0)


> +        self._blockedtimes[key] = self._blockedtimes.get(key, 0) +
> duration
>

self._blockedtimes[key] += duration
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20170209/993bea4e/attachment.html>


More information about the Mercurial-devel mailing list