changeset 33057:03eefca3ed33

debugrevlog: also display the largest delta chain span Mercurial read all data between the base of the chain and the last delta when restoring content (including unrelated delta). To monitor this, we add data about the size of the "delta chain span" to debugrevlog.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 23 Jun 2017 01:38:10 +0200
parents 2312e70cf78b
children 1aa05203f7f6
files mercurial/debugcommands.py tests/test-debugcommands.t
diffstat 2 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Sat Jun 24 21:13:48 2017 -0700
+++ b/mercurial/debugcommands.py	Fri Jun 23 01:38:10 2017 +0200
@@ -1749,6 +1749,8 @@
     nump1prev = 0
     nump2prev = 0
     chainlengths = []
+    chainbases = []
+    chainspans = []
 
     datasize = [None, 0, 0]
     fullsize = [None, 0, 0]
@@ -1774,10 +1776,16 @@
         size = r.length(rev)
         if delta == nullrev:
             chainlengths.append(0)
+            chainbases.append(r.start(rev))
+            chainspans.append(size)
             numfull += 1
             addsize(size, fullsize)
         else:
             chainlengths.append(chainlengths[delta] + 1)
+            baseaddr = chainbases[delta]
+            revaddr = r.start(rev)
+            chainbases.append(baseaddr)
+            chainspans.append((revaddr - baseaddr) + size)
             addsize(size, deltasize)
             if delta == rev - 1:
                 numprev += 1
@@ -1823,6 +1831,7 @@
     totalsize = fulltotal + deltatotal
     avgchainlen = sum(chainlengths) / numrevs
     maxchainlen = max(chainlengths)
+    maxchainspan = max(chainspans)
     compratio = 1
     if totalsize:
         compratio = totalrawsize / totalsize
@@ -1879,6 +1888,7 @@
     fmt = dfmtstr(max(avgchainlen, compratio))
     ui.write(('avg chain length  : ') + fmt % avgchainlen)
     ui.write(('max chain length  : ') + fmt % maxchainlen)
+    ui.write(('max chain reach  : ') + fmt % maxchainspan)
     ui.write(('compression ratio : ') + fmt % compratio)
 
     if format > 0:
--- a/tests/test-debugcommands.t	Sat Jun 24 21:13:48 2017 -0700
+++ b/tests/test-debugcommands.t	Fri Jun 23 01:38:10 2017 +0200
@@ -29,6 +29,7 @@
   
   avg chain length  : 0
   max chain length  : 0
+  max chain reach  : 44
   compression ratio : 0
   
   uncompressed data size (min/max/avg) : 43 / 43 / 43