Patchwork [1,of,3] perfphases: add 'perfphases' command

login
register
mail settings
Submitter Pierre-Yves David
Date May 23, 2017, 2:04 p.m.
Message ID <e7b7317363359a4bb15b.1495548261@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/20864/
State Accepted
Headers show

Comments

Pierre-Yves David - May 23, 2017, 2:04 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1495498987 -7200
#      Tue May 23 02:23:07 2017 +0200
# Node ID e7b7317363359a4bb15b5713ff034c6fd2008339
# Parent  e8c043375b53b30c4b468687f08323cbeeb452ef
# EXP-Topic perf
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r e7b731736335
perfphases: add 'perfphases' command

This commands benchmark the time spend computing the data in a repository.
Gregory Szorc - May 26, 2017, 4:58 p.m.
On Tue, May 23, 2017 at 7:04 AM, Pierre-Yves David <
pierre-yves.david@ens-lyon.org> wrote:

> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@octobus.net>
> # Date 1495498987 -7200
> #      Tue May 23 02:23:07 2017 +0200
> # Node ID e7b7317363359a4bb15b5713ff034c6fd2008339
> # Parent  e8c043375b53b30c4b468687f08323cbeeb452ef
> # EXP-Topic perf
> # Available At https://www.mercurial-scm.org/
> repo/users/marmoute/mercurial/
> #              hg pull https://www.mercurial-scm.org/
> repo/users/marmoute/mercurial/ -r e7b731736335
> perfphases: add 'perfphases' command
>
> This commands benchmark the time spend computing the data in a repository.
>

I queued this patch.


>
> diff --git a/contrib/perf.py b/contrib/perf.py
> --- a/contrib/perf.py
> +++ b/contrib/perf.py
> @@ -581,6 +581,17 @@ def perfpathcopies(ui, repo, rev1, rev2,
>      timer(d)
>      fm.end()
>
> +@command('perfphases', [], "")
> +def perfphases(ui, repo, **opts):
> +    """benchmark phasesets computation"""
> +    timer, fm = gettimer(ui, opts)
> +    phases = repo._phasecache
> +    def d():
> +        phases.invalidate()
> +        phases.loadphaserevs(repo)
> +    timer(d)
> +    fm.end()
> +
>  @command('perfmanifest', [], 'REV')
>  def perfmanifest(ui, repo, rev, **opts):
>      timer, fm = gettimer(ui, opts)
> diff --git a/tests/test-contrib-perf.t b/tests/test-contrib-perf.t
> --- a/tests/test-contrib-perf.t
> +++ b/tests/test-contrib-perf.t
> @@ -93,6 +93,7 @@ perfstatus
>     perfparents   (no help text available)
>     perfpathcopies
>                   (no help text available)
> +   perfphases    benchmark phasesets computation
>     perfrawfiles  (no help text available)
>     perfrevlog    Benchmark reading a series of revisions from a revlog.
>     perfrevlogchunks
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -581,6 +581,17 @@  def perfpathcopies(ui, repo, rev1, rev2,
     timer(d)
     fm.end()
 
+@command('perfphases', [], "")
+def perfphases(ui, repo, **opts):
+    """benchmark phasesets computation"""
+    timer, fm = gettimer(ui, opts)
+    phases = repo._phasecache
+    def d():
+        phases.invalidate()
+        phases.loadphaserevs(repo)
+    timer(d)
+    fm.end()
+
 @command('perfmanifest', [], 'REV')
 def perfmanifest(ui, repo, rev, **opts):
     timer, fm = gettimer(ui, opts)
diff --git a/tests/test-contrib-perf.t b/tests/test-contrib-perf.t
--- a/tests/test-contrib-perf.t
+++ b/tests/test-contrib-perf.t
@@ -93,6 +93,7 @@  perfstatus
    perfparents   (no help text available)
    perfpathcopies
                  (no help text available)
+   perfphases    benchmark phasesets computation
    perfrawfiles  (no help text available)
    perfrevlog    Benchmark reading a series of revisions from a revlog.
    perfrevlogchunks