diff mercurial/debugcommands.py @ 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 e8c8d81eb864
children e21b750c9b9e
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: