Mercurial > hg-stable
changeset 40730:a65fe13de84f
perf: add a new `perfhelper-tracecopies` command
The command is not measuring performance itself, it digs interesting statistic
to help pick good arguments for the `perfcopytrace` command.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Mon, 19 Nov 2018 14:14:56 +0000 |
parents | efd0f79246e3 |
children | f3f4d8537b11 |
files | contrib/perf.py tests/test-contrib-perf.t |
diffstat | 2 files changed, 51 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/perf.py Fri Sep 21 09:19:42 2018 -0700 +++ b/contrib/perf.py Mon Nov 19 14:14:56 2018 +0000 @@ -1153,6 +1153,54 @@ timer(format) fm.end() +@command(b'perfhelper-tracecopies', formatteropts + + [ + (b'r', b'revs', [], b'restrict search to these revisions'), + ]) +def perfhelpertracecopies(ui, repo, revs=[], **opts): + """find statistic about potential parameters for the `perftracecopies` + + This command find source-destination pair relevant for copytracing testing. + It report value for some of the parameters that impact copy tracing time. + """ + opts = _byteskwargs(opts) + fm = ui.formatter(b'perf', opts) + header = '%12s %12s %12s %12s\n' + output = ("%(source)12s %(destination)12s " + "%(nbrevs)12d %(nbmissingfiles)12d\n") + fm.plain(header % ("source", "destination", "nb-revs", "nb-files")) + + if not revs: + revs = ['all()'] + revs = scmutil.revrange(repo, revs) + + roi = repo.revs('merge() and %ld', revs) + for r in roi: + ctx = repo[r] + p1 = ctx.p1().rev() + p2 = ctx.p2().rev() + bases = repo.changelog._commonancestorsheads(p1, p2) + for p in (p1, p2): + for b in bases: + base = repo[b] + parent = repo[p] + missing = copies._computeforwardmissing(base, parent) + if not missing: + continue + fm.startitem() + data = { + b'source': base.hex(), + b'destination': parent.hex(), + b'nbrevs': len(repo.revs('%d::%d', b, p)), + b'nbmissingfiles': len(missing), + } + fm.data(**data) + out = data.copy() + out['source'] = fm.hexfunc(base.node()) + out['destination'] = fm.hexfunc(parent.node()) + fm.plain(output % out) + fm.end() + @command(b'perfcca', formatteropts) def perfcca(ui, repo, **opts): opts = _byteskwargs(opts)
--- a/tests/test-contrib-perf.t Fri Sep 21 09:19:42 2018 -0700 +++ b/tests/test-contrib-perf.t Mon Nov 19 14:14:56 2018 +0000 @@ -83,6 +83,9 @@ perffncachewrite (no help text available) perfheads (no help text available) + perfhelper-tracecopies + find statistic about potential parameters for the + 'perftracecopies' perfindex (no help text available) perflinelogedits (no help text available)