Mercurial > public > mercurial-scm > hg
comparison mercurial/dispatch.py @ 30976: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 |
comparison
equal
deleted
inserted
replaced
30975:22fbca1d11ed | 30976:e92daf156d5c |
---|---|
135 raise | 135 raise |
136 ret = -1 | 136 ret = -1 |
137 finally: | 137 finally: |
138 duration = util.timer() - starttime | 138 duration = util.timer() - starttime |
139 req.ui.flush() | 139 req.ui.flush() |
140 if req.ui.logblockedtimes: | |
141 req.ui._blockedtimes['command_duration'] = duration * 1000 | |
142 req.ui.log('uiblocked', 'ui blocked ms', **req.ui._blockedtimes) | |
140 req.ui.log("commandfinish", "%s exited %s after %0.2f seconds\n", | 143 req.ui.log("commandfinish", "%s exited %s after %0.2f seconds\n", |
141 msg, ret or 0, duration) | 144 msg, ret or 0, duration) |
142 return ret | 145 return ret |
143 | 146 |
144 def _runcatch(req): | 147 def _runcatch(req): |