debug-discovery: gather the right number of roundtrips for tree discovery stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 26 Jul 2022 10:34:20 +0200
branchstable
changeset 49402 236702592ff0
parent 49401 362c0026a977
child 49403 ac4fda5d3ccd
debug-discovery: gather the right number of roundtrips for tree discovery We where not counting the right amount of request before.
mercurial/debugcommands.py
mercurial/treediscovery.py
tests/test-setdiscovery.t
--- a/mercurial/debugcommands.py	Tue Jul 26 10:04:06 2022 +0200
+++ b/mercurial/debugcommands.py	Tue Jul 26 10:34:20 2022 +0200
@@ -1378,6 +1378,19 @@
     # display discovery summary
     fm.plain(b"elapsed time:  %(elapsed)f seconds\n" % data)
     fm.plain(b"round-trips:           %(total-roundtrips)9d\n" % data)
+    if b'total-round-trips-heads' in data:
+        fm.plain(
+            b"  round-trips-heads:    %(total-round-trips-heads)9d\n" % data
+        )
+    if b'total-round-trips-branches' in data:
+        fm.plain(
+            b"  round-trips-branches:    %(total-round-trips-branches)9d\n"
+            % data
+        )
+    if b'total-round-trips-between' in data:
+        fm.plain(
+            b"  round-trips-between:    %(total-round-trips-between)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)
--- a/mercurial/treediscovery.py	Tue Jul 26 10:04:06 2022 +0200
+++ b/mercurial/treediscovery.py	Tue Jul 26 10:34:20 2022 +0200
@@ -38,6 +38,9 @@
 
     if audit is not None:
         audit[b'total-roundtrips'] = 1
+        audit[b'total-roundtrips-heads'] = 1
+        audit[b'total-roundtrips-branches'] = 0
+        audit[b'total-roundtrips-between'] = 0
         audit[b'total-queries'] = 0
         audit[b'total-queries-branches'] = 0
         audit[b'total-queries-between'] = 0
@@ -74,6 +77,8 @@
         if audit is not None:
             audit[b'total-queries'] += len(unknown)
             audit[b'total-queries-branches'] += len(unknown)
+            audit[b'total-roundtrips'] += 1
+            audit[b'total-roundtrips-branches'] += 1
         branches = e.callcommand(b'branches', {b'nodes': unknown}).result()
 
     unknown = collections.deque(branches)
@@ -124,6 +129,8 @@
                     if audit is not None:
                         audit[b'total-queries'] += len(subset)
                         audit[b'total-queries-branches'] += len(subset)
+                        audit[b'total-roundtrips'] += 1
+                        audit[b'total-roundtrips-branches'] += 1
                     branches = e.callcommand(
                         b'branches',
                         {
@@ -147,6 +154,8 @@
             if audit is not None:
                 audit[b'total-queries'] += len(search)
                 audit[b'total-queries-between'] += len(search)
+                audit[b'total-roundtrips'] += 1
+                audit[b'total-roundtrips-between'] += 1
             between = e.callcommand(b'between', {b'pairs': search}).result()
 
         for n, l in zip(search, between):
@@ -192,7 +201,5 @@
 
     progress.complete()
     repo.ui.debug(b"%d total queries\n" % reqcnt)
-    if audit is not None:
-        audit[b'total-roundtrips'] = reqcnt
 
     return base, list(fetch), heads
--- a/tests/test-setdiscovery.t	Tue Jul 26 10:04:06 2022 +0200
+++ b/tests/test-setdiscovery.t	Tue Jul 26 10:34:20 2022 +0200
@@ -44,7 +44,7 @@
   searching for changes
   unpruned common: 01241442b3c2 66f7d451a68b b5714e113bc0
   elapsed time:  * seconds (glob)
-  round-trips:                   2
+  round-trips:                   4
   queries:                       6
     queries-branches:            2
     queries-between:             4
@@ -251,7 +251,7 @@
   searching for changes
   unpruned common: bebd167eb94d
   elapsed time:  * seconds (glob)
-  round-trips:                   2
+  round-trips:                   4
   queries:                       3
     queries-branches:            1
     queries-between:             2
@@ -357,7 +357,7 @@
   searching for changes
   unpruned common: 66f7d451a68b bebd167eb94d
   elapsed time:  * seconds (glob)
-  round-trips:                   4
+  round-trips:                   6
   queries:                       5
     queries-branches:            1
     queries-between:             4
@@ -469,7 +469,7 @@
   searching for changes
   unpruned common: 2dc09a01254d
   elapsed time:  * seconds (glob)
-  round-trips:                   4
+  round-trips:                   6
   queries:                       5
     queries-branches:            1
     queries-between:             4
@@ -575,7 +575,7 @@
   searching for changes
   unpruned common: 2dc09a01254d 66f7d451a68b
   elapsed time:  * seconds (glob)
-  round-trips:                   4
+  round-trips:                   6
   queries:                       5
     queries-branches:            1
     queries-between:             4
@@ -688,7 +688,7 @@
   searching for changes
   unpruned common: 66f7d451a68b
   elapsed time:  * seconds (glob)
-  round-trips:                   4
+  round-trips:                   6
   queries:                       5
     queries-branches:            1
     queries-between:             4
@@ -794,7 +794,7 @@
   searching for changes
   unpruned common: 66f7d451a68b
   elapsed time:  * seconds (glob)
-  round-trips:                   4
+  round-trips:                   6
   queries:                       5
     queries-branches:            1
     queries-between:             4
@@ -907,7 +907,7 @@
   searching for changes
   unpruned common: 66f7d451a68b
   elapsed time:  * seconds (glob)
-  round-trips:                   4
+  round-trips:                   6
   queries:                       5
     queries-branches:            1
     queries-between:             4
@@ -1013,7 +1013,7 @@
   searching for changes
   unpruned common: 66f7d451a68b
   elapsed time:  * seconds (glob)
-  round-trips:                   3
+  round-trips:                   5
   queries:                       4
     queries-branches:            1
     queries-between:             3
@@ -1126,7 +1126,7 @@
   searching for changes
   unpruned common: 7ead0cba2838
   elapsed time:  * seconds (glob)
-  round-trips:                   4
+  round-trips:                   6
   queries:                       5
     queries-branches:            1
     queries-between:             4
@@ -1238,7 +1238,7 @@
   searching for changes
   unpruned common: 7ead0cba2838
   elapsed time:  * seconds (glob)
-  round-trips:                   3
+  round-trips:                   5
   queries:                       4
     queries-branches:            1
     queries-between:             3