##// END OF EJS Templates
cleanup: make all uses of timedcm specify what they're timing...
Augie Fackler -
r39294:331ab85e default
parent child Browse files
Show More
@@ -177,7 +177,7 b' def load(ui, name, path, log=lambda *a: '
177 return _extensions[shortname]
177 return _extensions[shortname]
178 log(' - loading extension: %r\n', shortname)
178 log(' - loading extension: %r\n', shortname)
179 _extensions[shortname] = None
179 _extensions[shortname] = None
180 with util.timedcm() as stats:
180 with util.timedcm('load extension %r', shortname) as stats:
181 mod = _importext(name, path, bind(_reportimporterror, ui))
181 mod = _importext(name, path, bind(_reportimporterror, ui))
182 log(' > %r extension loaded in %s\n', shortname, stats)
182 log(' > %r extension loaded in %s\n', shortname, stats)
183
183
@@ -196,7 +196,7 b' def load(ui, name, path, log=lambda *a: '
196 _extensions[shortname] = mod
196 _extensions[shortname] = mod
197 _order.append(shortname)
197 _order.append(shortname)
198 log(' - invoking registered callbacks: %r\n', shortname)
198 log(' - invoking registered callbacks: %r\n', shortname)
199 with util.timedcm() as stats:
199 with util.timedcm('callbacks extension %r', shortname) as stats:
200 for fn in _aftercallbacks.get(shortname, []):
200 for fn in _aftercallbacks.get(shortname, []):
201 fn(loaded=True)
201 fn(loaded=True)
202 log(' > callbacks completed in %s\n', stats)
202 log(' > callbacks completed in %s\n', stats)
@@ -243,7 +243,7 b' def loadall(ui, whitelist=None):'
243 newindex = len(_order)
243 newindex = len(_order)
244 log('loading %sextensions\n', 'additional ' if newindex else '')
244 log('loading %sextensions\n', 'additional ' if newindex else '')
245 log('- processing %d entries\n', len(result))
245 log('- processing %d entries\n', len(result))
246 with util.timedcm() as stats:
246 with util.timedcm('load all extensions') as stats:
247 for (name, path) in result:
247 for (name, path) in result:
248 if path:
248 if path:
249 if path[0:1] == '!':
249 if path[0:1] == '!':
@@ -286,7 +286,7 b' def loadall(ui, whitelist=None):'
286 log('- executing uisetup hooks\n')
286 log('- executing uisetup hooks\n')
287 for name in _order[newindex:]:
287 for name in _order[newindex:]:
288 log(' - running uisetup for %r\n', name)
288 log(' - running uisetup for %r\n', name)
289 with util.timedcm() as stats:
289 with util.timedcm('uisetup %r', name) as stats:
290 if not _runuisetup(name, ui):
290 if not _runuisetup(name, ui):
291 log(' - the %r extension uisetup failed\n', name)
291 log(' - the %r extension uisetup failed\n', name)
292 broken.add(name)
292 broken.add(name)
@@ -297,7 +297,7 b' def loadall(ui, whitelist=None):'
297 if name in broken:
297 if name in broken:
298 continue
298 continue
299 log(' - running extsetup for %r\n', name)
299 log(' - running extsetup for %r\n', name)
300 with util.timedcm() as stats:
300 with util.timedcm('extsetup %r', name) as stats:
301 if not _runextsetup(name, ui):
301 if not _runextsetup(name, ui):
302 log(' - the %r extension extsetup failed\n', name)
302 log(' - the %r extension extsetup failed\n', name)
303 broken.add(name)
303 broken.add(name)
@@ -309,7 +309,7 b' def loadall(ui, whitelist=None):'
309
309
310 # Call aftercallbacks that were never met.
310 # Call aftercallbacks that were never met.
311 log('- executing remaining aftercallbacks\n')
311 log('- executing remaining aftercallbacks\n')
312 with util.timedcm() as stats:
312 with util.timedcm('aftercallbacks') as stats:
313 for shortname in _aftercallbacks:
313 for shortname in _aftercallbacks:
314 if shortname in _extensions:
314 if shortname in _extensions:
315 continue
315 continue
@@ -353,7 +353,7 b' def loadall(ui, whitelist=None):'
353 ('templatefunc', templatefuncs, 'loadfunction'),
353 ('templatefunc', templatefuncs, 'loadfunction'),
354 ('templatekeyword', templatekw, 'loadkeyword'),
354 ('templatekeyword', templatekw, 'loadkeyword'),
355 ]
355 ]
356 with util.timedcm() as stats:
356 with util.timedcm('load registration objects') as stats:
357 _loadextra(ui, newindex, extraloaders)
357 _loadextra(ui, newindex, extraloaders)
358 log('> extension registration object loading took %s\n', stats)
358 log('> extension registration object loading took %s\n', stats)
359 log('extension loading complete\n')
359 log('extension loading complete\n')
@@ -2929,7 +2929,7 b' def timed(func):'
2929 '''
2929 '''
2930
2930
2931 def wrapper(*args, **kwargs):
2931 def wrapper(*args, **kwargs):
2932 with timedcm() as time_stats:
2932 with timedcm(pycompat.bytestr(func.__name__)) as time_stats:
2933 result = func(*args, **kwargs)
2933 result = func(*args, **kwargs)
2934 stderr = procutil.stderr
2934 stderr = procutil.stderr
2935 stderr.write('%s%s: %s\n' % (
2935 stderr.write('%s%s: %s\n' % (
@@ -78,7 +78,7 b' class timedtests(unittest.TestCase):'
78 def testtimedcmcleanexit(self):
78 def testtimedcmcleanexit(self):
79 # timestamps 1, 4, elapsed time of 4 - 1 = 3
79 # timestamps 1, 4, elapsed time of 4 - 1 = 3
80 with mocktimer([1, 3], _start_default):
80 with mocktimer([1, 3], _start_default):
81 with util.timedcm() as stats:
81 with util.timedcm('pass') as stats:
82 # actual context doesn't matter
82 # actual context doesn't matter
83 pass
83 pass
84
84
@@ -89,8 +89,8 b' class timedtests(unittest.TestCase):'
89 def testtimedcmnested(self):
89 def testtimedcmnested(self):
90 # timestamps 1, 3, 6, 10, elapsed times of 6 - 3 = 3 and 10 - 1 = 9
90 # timestamps 1, 3, 6, 10, elapsed times of 6 - 3 = 3 and 10 - 1 = 9
91 with mocktimer([1, 2, 3, 4], _start_default):
91 with mocktimer([1, 2, 3, 4], _start_default):
92 with util.timedcm() as outer_stats:
92 with util.timedcm('outer') as outer_stats:
93 with util.timedcm() as inner_stats:
93 with util.timedcm('inner') as inner_stats:
94 # actual context doesn't matter
94 # actual context doesn't matter
95 pass
95 pass
96
96
@@ -106,7 +106,7 b' class timedtests(unittest.TestCase):'
106 # timestamps 1, 4, elapsed time of 4 - 1 = 3
106 # timestamps 1, 4, elapsed time of 4 - 1 = 3
107 with mocktimer([1, 3], _start_default):
107 with mocktimer([1, 3], _start_default):
108 try:
108 try:
109 with util.timedcm() as stats:
109 with util.timedcm('exceptional') as stats:
110 raise ValueError()
110 raise ValueError()
111 except ValueError:
111 except ValueError:
112 pass
112 pass
General Comments 0
You need to be logged in to leave comments. Login now