diff mercurial/debugcommands.py @ 42035:eec20025ada3

debugdiscovery: display time elapsed during the discovery step This is a useful information. Now that we perform more analysing after the discovery is done, it is worth have a more precise measurement. For serious timing analysis use `hg perfdiscovery`.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 26 Mar 2019 17:35:28 +0100
parents fd8d13ea1bcc
children 3e47d1ec9da5
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Tue Mar 26 17:26:54 2019 +0100
+++ b/mercurial/debugcommands.py	Tue Mar 26 17:35:28 2019 +0100
@@ -815,7 +815,8 @@
 
     remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches, revs=None)
     localrevs = opts['rev']
-    common, hds = doit(localrevs, remoterevs)
+    with util.timedcm('debug-discovery') as t:
+        common, hds = doit(localrevs, remoterevs)
 
     # compute all statistics
     common = set(common)
@@ -823,6 +824,7 @@
     lheads = set(repo.heads())
 
     data = {}
+    data['elapsed'] = t.elapsed
     data['nb-common'] = len(common)
     data['nb-common-local'] = len(common & lheads)
     data['nb-common-remote'] = len(common & rheads)
@@ -835,6 +837,7 @@
     data['nb-revs-missing'] = data['nb-revs'] - data['nb-revs-common']
 
     # display discovery summary
+    ui.write(("elapsed time:  %(elapsed)f seconds\n") % data)
     ui.write(("heads summary:\n"))
     ui.write(("  total common heads:  %(nb-common)9d\n") % data)
     ui.write(("    also local heads:  %(nb-common-local)9d\n") % data)