[PATCH 2 of 2] perf: add a --stats argument to perfhelper-pathcopies
Augie Fackler
raf at durin42.com
Tue Sep 17 13:51:10 EDT 2019
queued these, thanks
> On Sep 17, 2019, at 12:48, Pierre-Yves David <pierre-yves.david at ens-lyon.org> wrote:
>
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at octobus.net>
> # Date 1568738190 -7200
> # Tue Sep 17 18:36:30 2019 +0200
> # Node ID 4b7259822c49347ad30219a89d3e791730438e75
> # Parent b4757cd4ef21160461bb0c6901719d3cd2ffd3f8
> # EXP-Topic copy-perf
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 4b7259822c49
> perf: add a --stats argument to perfhelper-pathcopies
>
> The arguments will display some statisting about the distribution of the value
> we measure.
>
> diff --git a/contrib/perf.py b/contrib/perf.py
> --- a/contrib/perf.py
> +++ b/contrib/perf.py
> @@ -1745,6 +1745,7 @@ def perfhelpermergecopies(ui, repo, revs
> [
> (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 @@ def perfhelperpathcopies(ui, repo, revs=
> 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 @@ def perfhelperpathcopies(ui, repo, revs=
> 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 @@ def perfhelperpathcopies(ui, repo, revs=
> 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 @@ def perfhelperpathcopies(ui, repo, revs=
> # 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 @@ def perfhelperpathcopies(ui, repo, revs=
> 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):
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list