changeset 4143:2ddd8785f8d7

pullbundle: add data about the cached bundle size and hit
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 25 Sep 2018 18:41:51 +0200
parents 683ceec8d37e
children b5cd26712e4b
files hgext3rd/pullbundle.py
diffstat 1 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/pullbundle.py	Tue Sep 25 18:23:46 2018 +0200
+++ b/hgext3rd/pullbundle.py	Tue Sep 25 18:41:51 2018 +0200
@@ -508,22 +508,40 @@
         totalchanges += entry[1]
         totalcached += entry[2]
 
+    cachedsizes = []
+    cachedhits = []
+    for rangeid, hits in bundlehits.items():
+        length = rlen(rangeid)
+        cachedsizes.append(length)
+        cachedhits.append(hits)
+
     sizesdist = distribution(sizes)
     repo.ui.write(fmtdist('pull size', sizesdist))
+
     changesmissingdist = distribution(changesmissing)
     repo.ui.write(fmtdist('non-cached changesets', changesmissingdist))
+
     changesratiodist = distribution(changesratio)
     repo.ui.write(fmtdist('ratio of cached changesets', changesratiodist))
+
     bundlecountdist = distribution(bundlecount)
     repo.ui.write(fmtdist('bundle count', bundlecountdist))
+
     rangesratiodist = distribution(rangesratio)
     repo.ui.write(fmtdist('ratio of cached bundles', rangesratiodist))
+
     repo.ui.write('changesets served:\n')
     repo.ui.write('  total:      %7d\n' % totalchanges)
     repo.ui.write('  from cache: %7d (%2d%%)\n'
                   % (totalcached, (totalcached * 100 // totalchanges)))
     repo.ui.write('  bundle:     %7d\n' % sum(bundlecount))
 
+    cachedsizesdist = distribution(cachedsizes)
+    repo.ui.write(fmtdist('size of cached bundles', cachedsizesdist))
+
+    cachedhitsdist = distribution(cachedhits)
+    repo.ui.write(fmtdist('hit on cached bundles', cachedhitsdist))
+
 def takeonesample(repo, revs):
     node = repo.changelog.node
     pulled = random.sample(revs, max(4, len(revs) // 1000))
@@ -541,6 +559,7 @@
         '50%': data[length // 2],
         '75%': data[(length // 4) * 3],
         '90%': data[(length // 10) * 9],
+        '95%': data[(length // 20) * 19],
         'max': data[-1],
     }
 
@@ -551,6 +570,7 @@
   50%: {50%}
   75%: {75%}
   90%: {90%}
+  95%: {95%}
   max: {max}
 """