Skip to content
Snippets Groups Projects
Commit adac17fa authored by Pierre-Yves David's avatar Pierre-Yves David :octopus:
Browse files

perf: add a --stats argument to perfhelper-pathcopies

The arguments will display some statisting about the distribution of the value
we measure.
parent 3a1ad3ae
No related branches found
No related tags found
No related merge requests found
......@@ -1745,6 +1745,7 @@
[
(b'r', b'revs', [], b'restrict search to these revisions'),
(b'', b'timing', False, b'provides extra data (costly)'),
(b'', b'stats', False, b'provides statistic about the measured data'),
])
def perfhelperpathcopies(ui, repo, revs=[], **opts):
"""find statistic about potential parameters for the `perftracecopies`
......@@ -1763,6 +1764,7 @@
opts = _byteskwargs(opts)
fm = ui.formatter(b'perf', opts)
dotiming = opts[b'timing']
dostats = opts[b'stats']
if dotiming:
header = '%12s %12s %12s %12s %12s %12s\n'
......@@ -1782,6 +1784,16 @@
revs = ['all()']
revs = scmutil.revrange(repo, revs)
if dostats:
alldata = {
'nbrevs': [],
'nbmissingfiles': [],
}
if dotiming:
alldata['nbrenames'] = []
alldata['time'] = []
roi = repo.revs('merge() and %ld', revs)
for r in roi:
ctx = repo[r]
......@@ -1801,6 +1813,16 @@
b'nbrevs': len(repo.revs('%d::%d', b, p)),
b'nbmissingfiles': len(missing),
}
alldata['nbrevs'].append((
data['nbrevs'],
base.hex(),
parent.hex(),
))
alldata['nbmissingfiles'].append((
data['nbmissingfiles'],
base.hex(),
parent.hex(),
))
if dotiming:
begin = util.timer()
renames = copies.pathcopies(base, parent)
......@@ -1808,6 +1830,16 @@
# not very stable timing since we did only one run
data['time'] = end - begin
data['nbrenamedfiles'] = len(renames)
alldata['time'].append((
data['time'],
base.hex(),
parent.hex(),
))
alldata['nbrenames'].append((
data['nbrenamedfiles'],
base.hex(),
parent.hex(),
))
fm.startitem()
fm.data(**data)
out = data.copy()
......@@ -1816,6 +1848,19 @@
fm.plain(output % out)
fm.end()
if dostats:
# use a second formatter because the data are quite different, not sure
# how it flies with the templater.
fm = ui.formatter(b'perf', opts)
entries = [
('nbrevs', 'number of revision covered'),
('nbmissingfiles', 'number of missing files at head'),
]
if dotiming:
entries.append(('nbrenames',
'renamed files'))
entries.append(('time', 'time'))
_displaystats(ui, opts, entries, alldata)
@command(b'perfcca', formatteropts)
def perfcca(ui, repo, **opts):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment