Mercurial > public > mercurial-scm > hg
comparison mercurial/dispatch.py @ 30975:22fbca1d11ed
mercurial: switch to util.timer for all interval timings
util.timer is now the best available interval timer, at the expense of not
having a known epoch. Let's use it whenever the epoch is irrelevant.
author | Simon Farnsworth <simonfar@fb.com> |
---|---|
date | Wed, 15 Feb 2017 13:17:39 -0800 |
parents | 6d642ecf1a89 |
children | e92daf156d5c |
comparison
equal
deleted
inserted
replaced
30974:ae5d60bb70c9 | 30975:22fbca1d11ed |
---|---|
121 except error.ParseError as inst: | 121 except error.ParseError as inst: |
122 _formatparse(ferr.write, inst) | 122 _formatparse(ferr.write, inst) |
123 return -1 | 123 return -1 |
124 | 124 |
125 msg = ' '.join(' ' in a and repr(a) or a for a in req.args) | 125 msg = ' '.join(' ' in a and repr(a) or a for a in req.args) |
126 starttime = time.time() | 126 starttime = util.timer() |
127 ret = None | 127 ret = None |
128 try: | 128 try: |
129 ret = _runcatch(req) | 129 ret = _runcatch(req) |
130 except KeyboardInterrupt: | 130 except KeyboardInterrupt: |
131 try: | 131 try: |
133 except IOError as inst: | 133 except IOError as inst: |
134 if inst.errno != errno.EPIPE: | 134 if inst.errno != errno.EPIPE: |
135 raise | 135 raise |
136 ret = -1 | 136 ret = -1 |
137 finally: | 137 finally: |
138 duration = time.time() - starttime | 138 duration = util.timer() - starttime |
139 req.ui.flush() | 139 req.ui.flush() |
140 req.ui.log("commandfinish", "%s exited %s after %0.2f seconds\n", | 140 req.ui.log("commandfinish", "%s exited %s after %0.2f seconds\n", |
141 msg, ret or 0, duration) | 141 msg, ret or 0, duration) |
142 return ret | 142 return ret |
143 | 143 |