diff mercurial/dispatch.py @ 30996:e92daf156d5c

ui: provide a mechanism to track and log blocked time We want to log the time Mercurial spends trapped in things outside programmatic control. Provide a mechanism to give us both command runtime and as many different sources of blocking as we deem useful.
author Simon Farnsworth <simonfar@fb.com>
date Wed, 15 Feb 2017 13:17:45 -0800
parents 22fbca1d11ed
children 9c2977ceaa46
line wrap: on
line diff
--- a/mercurial/dispatch.py	Wed Feb 15 13:17:39 2017 -0800
+++ b/mercurial/dispatch.py	Wed Feb 15 13:17:45 2017 -0800
@@ -137,6 +137,9 @@
     finally:
         duration = util.timer() - starttime
         req.ui.flush()
+        if req.ui.logblockedtimes:
+            req.ui._blockedtimes['command_duration'] = duration * 1000
+            req.ui.log('uiblocked', 'ui blocked ms', **req.ui._blockedtimes)
         req.ui.log("commandfinish", "%s exited %s after %0.2f seconds\n",
                    msg, ret or 0, duration)
     return ret