debug-discovery: also gather details on tree-discovery queries type stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 26 Jul 2022 10:04:06 +0200
branchstable
changeset 49401 362c0026a977
parent 49400 a1bb21542ab0
child 49402 236702592ff0
debug-discovery: also gather details on tree-discovery queries type This is useful to understand the algorithm.
mercurial/debugcommands.py
mercurial/treediscovery.py
tests/test-setdiscovery.t
--- a/mercurial/debugcommands.py	Tue Jul 26 04:56:29 2022 +0200
+++ b/mercurial/debugcommands.py	Tue Jul 26 10:04:06 2022 +0200
@@ -1379,6 +1379,10 @@
     fm.plain(b"elapsed time:  %(elapsed)f seconds\n" % data)
     fm.plain(b"round-trips:           %(total-roundtrips)9d\n" % data)
     fm.plain(b"queries:               %(total-queries)9d\n" % data)
+    if b'total-queries-branches' in data:
+        fm.plain(b"  queries-branches:    %(total-queries-branches)9d\n" % data)
+    if b'total-queries-between' in data:
+        fm.plain(b"  queries-between:     %(total-queries-between)9d\n" % data)
     fm.plain(b"heads summary:\n")
     fm.plain(b"  total common heads:  %(nb-common-heads)9d\n" % data)
     fm.plain(b"    also local heads:  %(nb-common-heads-local)9d\n" % data)
--- a/mercurial/treediscovery.py	Tue Jul 26 04:56:29 2022 +0200
+++ b/mercurial/treediscovery.py	Tue Jul 26 10:04:06 2022 +0200
@@ -39,6 +39,8 @@
     if audit is not None:
         audit[b'total-roundtrips'] = 1
         audit[b'total-queries'] = 0
+        audit[b'total-queries-branches'] = 0
+        audit[b'total-queries-between'] = 0
 
     if repo.changelog.tip() == repo.nullid:
         base.add(repo.nullid)
@@ -71,6 +73,7 @@
     with remote.commandexecutor() as e:
         if audit is not None:
             audit[b'total-queries'] += len(unknown)
+            audit[b'total-queries-branches'] += len(unknown)
         branches = e.callcommand(b'branches', {b'nodes': unknown}).result()
 
     unknown = collections.deque(branches)
@@ -120,6 +123,7 @@
                     subset = r[p : p + 10]
                     if audit is not None:
                         audit[b'total-queries'] += len(subset)
+                        audit[b'total-queries-branches'] += len(subset)
                     branches = e.callcommand(
                         b'branches',
                         {
@@ -142,6 +146,7 @@
         with remote.commandexecutor() as e:
             if audit is not None:
                 audit[b'total-queries'] += len(search)
+                audit[b'total-queries-between'] += len(search)
             between = e.callcommand(b'between', {b'pairs': search}).result()
 
         for n, l in zip(search, between):
--- a/tests/test-setdiscovery.t	Tue Jul 26 04:56:29 2022 +0200
+++ b/tests/test-setdiscovery.t	Tue Jul 26 10:04:06 2022 +0200
@@ -46,6 +46,8 @@
   elapsed time:  * seconds (glob)
   round-trips:                   2
   queries:                       6
+    queries-branches:            2
+    queries-between:             4
   heads summary:
     total common heads:          2
       also local heads:          2
@@ -144,6 +146,8 @@
   elapsed time:  * seconds (glob)
   round-trips:                   1
   queries:                       0
+    queries-branches:            0
+    queries-between:             0
   heads summary:
     total common heads:          2
       also local heads:          1
@@ -249,6 +253,8 @@
   elapsed time:  * seconds (glob)
   round-trips:                   2
   queries:                       3
+    queries-branches:            1
+    queries-between:             2
   heads summary:
     total common heads:          1
       also local heads:          1
@@ -353,6 +359,8 @@
   elapsed time:  * seconds (glob)
   round-trips:                   4
   queries:                       5
+    queries-branches:            1
+    queries-between:             4
   heads summary:
     total common heads:          1
       also local heads:          0
@@ -463,6 +471,8 @@
   elapsed time:  * seconds (glob)
   round-trips:                   4
   queries:                       5
+    queries-branches:            1
+    queries-between:             4
   heads summary:
     total common heads:          1
       also local heads:          1
@@ -567,6 +577,8 @@
   elapsed time:  * seconds (glob)
   round-trips:                   4
   queries:                       5
+    queries-branches:            1
+    queries-between:             4
   heads summary:
     total common heads:          1
       also local heads:          0
@@ -678,6 +690,8 @@
   elapsed time:  * seconds (glob)
   round-trips:                   4
   queries:                       5
+    queries-branches:            1
+    queries-between:             4
   heads summary:
     total common heads:          1
       also local heads:          0
@@ -782,6 +796,8 @@
   elapsed time:  * seconds (glob)
   round-trips:                   4
   queries:                       5
+    queries-branches:            1
+    queries-between:             4
   heads summary:
     total common heads:          1
       also local heads:          0
@@ -893,6 +909,8 @@
   elapsed time:  * seconds (glob)
   round-trips:                   4
   queries:                       5
+    queries-branches:            1
+    queries-between:             4
   heads summary:
     total common heads:          1
       also local heads:          0
@@ -997,6 +1015,8 @@
   elapsed time:  * seconds (glob)
   round-trips:                   3
   queries:                       4
+    queries-branches:            1
+    queries-between:             3
   heads summary:
     total common heads:          1
       also local heads:          0
@@ -1108,6 +1128,8 @@
   elapsed time:  * seconds (glob)
   round-trips:                   4
   queries:                       5
+    queries-branches:            1
+    queries-between:             4
   heads summary:
     total common heads:          1
       also local heads:          0
@@ -1218,6 +1240,8 @@
   elapsed time:  * seconds (glob)
   round-trips:                   3
   queries:                       4
+    queries-branches:            1
+    queries-between:             3
   heads summary:
     total common heads:          1
       also local heads:          0