2230 fm.end() |
2230 fm.end() |
2231 |
2231 |
2232 @command(b'perfbranchmapload', [ |
2232 @command(b'perfbranchmapload', [ |
2233 (b'f', b'filter', b'', b'Specify repoview filter'), |
2233 (b'f', b'filter', b'', b'Specify repoview filter'), |
2234 (b'', b'list', False, b'List brachmap filter caches'), |
2234 (b'', b'list', False, b'List brachmap filter caches'), |
|
2235 (b'', b'clear-revlogs', False, b'refresh changelog and manifest'), |
|
2236 |
2235 ] + formatteropts) |
2237 ] + formatteropts) |
2236 def perfbranchmapload(ui, repo, filter=b'', list=False, **opts): |
2238 def perfbranchmapload(ui, repo, filter=b'', list=False, **opts): |
2237 """benchmark reading the branchmap""" |
2239 """benchmark reading the branchmap""" |
2238 opts = _byteskwargs(opts) |
2240 opts = _byteskwargs(opts) |
|
2241 clearrevlogs = opts[b'clear_revlogs'] |
2239 |
2242 |
2240 if list: |
2243 if list: |
2241 for name, kind, st in repo.cachevfs.readdir(stat=True): |
2244 for name, kind, st in repo.cachevfs.readdir(stat=True): |
2242 if name.startswith(b'branch2'): |
2245 if name.startswith(b'branch2'): |
2243 filtername = name.partition(b'-')[2] or b'unfiltered' |
2246 filtername = name.partition(b'-')[2] or b'unfiltered' |
2251 # try once without timer, the filter may not be cached |
2254 # try once without timer, the filter may not be cached |
2252 if branchmap.read(repo) is None: |
2255 if branchmap.read(repo) is None: |
2253 raise error.Abort(b'No branchmap cached for %s repo' |
2256 raise error.Abort(b'No branchmap cached for %s repo' |
2254 % (filter or b'unfiltered')) |
2257 % (filter or b'unfiltered')) |
2255 timer, fm = gettimer(ui, opts) |
2258 timer, fm = gettimer(ui, opts) |
|
2259 def setup(): |
|
2260 if clearrevlogs: |
|
2261 clearchangelog(repo) |
2256 def bench(): |
2262 def bench(): |
2257 branchmap.read(repo) |
2263 branchmap.read(repo) |
2258 timer(bench) |
2264 timer(bench, setup=setup) |
2259 fm.end() |
2265 fm.end() |
2260 |
2266 |
2261 @command(b'perfloadmarkers') |
2267 @command(b'perfloadmarkers') |
2262 def perfloadmarkers(ui, repo): |
2268 def perfloadmarkers(ui, repo): |
2263 """benchmark the time to parse the on-disk markers for a repo |
2269 """benchmark the time to parse the on-disk markers for a repo |