comparison mercurial/branchmap.py @ 30995: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 3dbc95f3eb31
children 2a18e9e6ca43
comparison
equal deleted inserted replaced
30994:ae5d60bb70c9 30995:22fbca1d11ed
7 7
8 from __future__ import absolute_import 8 from __future__ import absolute_import
9 9
10 import array 10 import array
11 import struct 11 import struct
12 import time
13 12
14 from .node import ( 13 from .node import (
15 bin, 14 bin,
16 hex, 15 hex,
17 nullid, 16 nullid,
19 ) 18 )
20 from . import ( 19 from . import (
21 encoding, 20 encoding,
22 error, 21 error,
23 scmutil, 22 scmutil,
23 util,
24 ) 24 )
25 25
26 array = array.array 26 array = array.array
27 calcsize = struct.calcsize 27 calcsize = struct.calcsize
28 pack = struct.pack 28 pack = struct.pack
259 def update(self, repo, revgen): 259 def update(self, repo, revgen):
260 """Given a branchhead cache, self, that may have extra nodes or be 260 """Given a branchhead cache, self, that may have extra nodes or be
261 missing heads, and a generator of nodes that are strictly a superset of 261 missing heads, and a generator of nodes that are strictly a superset of
262 heads missing, this function updates self to be correct. 262 heads missing, this function updates self to be correct.
263 """ 263 """
264 starttime = time.time() 264 starttime = util.timer()
265 cl = repo.changelog 265 cl = repo.changelog
266 # collect new branch entries 266 # collect new branch entries
267 newbranches = {} 267 newbranches = {}
268 getbranchinfo = repo.revbranchcache().branchinfo 268 getbranchinfo = repo.revbranchcache().branchinfo
269 for r in revgen: 269 for r in revgen:
312 if tiprev > self.tiprev: 312 if tiprev > self.tiprev:
313 self.tipnode = cl.node(tiprev) 313 self.tipnode = cl.node(tiprev)
314 self.tiprev = tiprev 314 self.tiprev = tiprev
315 self.filteredhash = scmutil.filteredhash(repo, self.tiprev) 315 self.filteredhash = scmutil.filteredhash(repo, self.tiprev)
316 316
317 duration = time.time() - starttime 317 duration = util.timer() - starttime
318 repo.ui.log('branchcache', 'updated %s branch cache in %.4f seconds\n', 318 repo.ui.log('branchcache', 'updated %s branch cache in %.4f seconds\n',
319 repo.filtername, duration) 319 repo.filtername, duration)
320 320
321 # Revision branch info cache 321 # Revision branch info cache
322 322