Patchwork [2,of,8] perfphases: add a flag to also include file access time

login
register
mail settings
Submitter Pierre-Yves David
Date June 8, 2017, 7:44 p.m.
Message ID <c54764352df4e2a648c7.1496951058@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/21255/
State Accepted
Headers show

Comments

Pierre-Yves David - June 8, 2017, 7:44 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1495499261 -7200
#      Tue May 23 02:27:41 2017 +0200
# Node ID c54764352df4e2a648c76e8bea60f5631047de7a
# Parent  bbc6d0c724ddd10f0d45971d9faf1a875bdee714
# 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 c54764352df4
perfphases: add a flag to also include file access time

The flag purges all phases data so we'll have to read the file from disk again.

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -591,12 +591,19 @@  def perfpathcopies(ui, repo, rev1, rev2,
     timer(d)
     fm.end()
 
-@command('perfphases', [], "")
+@command('perfphases',
+         [('', 'full', False, 'include file reading time too'),
+         ], "")
 def perfphases(ui, repo, **opts):
     """benchmark phasesets computation"""
     timer, fm = gettimer(ui, opts)
-    phases = repo._phasecache
+    _phases = repo._phasecache
+    full = opts.get('full')
     def d():
+        phases = _phases
+        if full:
+            clearfilecache(repo, '_phasecache')
+            phases = repo._phasecache
         phases.invalidate()
         phases.loadphaserevs(repo)
     timer(d)