changeset 39980:d71e0ba34d9b

debugcommands: add a debugindexstats command Someone went through the trouble of recording these stats, so let's make them accessible. Differential Revision: https://phab.mercurial-scm.org/D4832
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 08 Aug 2018 23:17:16 -0700
parents 6bdee4bc181a
children da0319e024c0
files mercurial/debugcommands.py tests/test-completion.t tests/test-debugcommands.t tests/test-help.t
diffstat 4 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Mon Sep 24 19:23:50 2018 +0900
+++ b/mercurial/debugcommands.py	Wed Aug 08 23:17:16 2018 -0700
@@ -1164,6 +1164,13 @@
             ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i))
     ui.write("}\n")
 
+@command('debugindexstats', [])
+def debugindexstats(ui, repo):
+    """show stats related to the changelog index"""
+    repo.changelog.shortest(nullid, 1)
+    for k, v in sorted(repo.changelog.index.stats().items()):
+        ui.write('%s: %s\n' % (k, v))
+
 @command('debuginstall', [] + cmdutil.formatteropts, '', norepo=True)
 def debuginstall(ui, **opts):
     '''test Mercurial installation
--- a/tests/test-completion.t	Mon Sep 24 19:23:50 2018 +0900
+++ b/tests/test-completion.t	Wed Aug 08 23:17:16 2018 -0700
@@ -94,6 +94,7 @@
   debugignore
   debugindex
   debugindexdot
+  debugindexstats
   debuginstall
   debugknown
   debuglabelcomplete
@@ -282,6 +283,7 @@
   debugignore: 
   debugindex: changelog, manifest, dir, template
   debugindexdot: changelog, manifest, dir
+  debugindexstats: 
   debuginstall: template
   debugknown: 
   debuglabelcomplete: 
--- a/tests/test-debugcommands.t	Mon Sep 24 19:23:50 2018 +0900
+++ b/tests/test-debugcommands.t	Wed Aug 08 23:17:16 2018 -0700
@@ -177,6 +177,16 @@
 debugdelta chain basic output
 
 #if reporevlogstore
+  $ hg debugindexstats
+  node trie capacity: 4
+  node trie count: 2
+  node trie depth: 1
+  node trie last rev scanned: -1
+  node trie lookups: 4
+  node trie misses: 1
+  node trie splits: 1
+  revs in memory: 3
+
   $ hg debugdeltachain -m
       rev  chain# chainlen     prev   delta       size    rawsize  chainsize     ratio   lindist extradist extraratio
         0       1        1       -1    base         44         43         44   1.02326        44         0    0.00000
--- a/tests/test-help.t	Mon Sep 24 19:23:50 2018 +0900
+++ b/tests/test-help.t	Wed Aug 08 23:17:16 2018 -0700
@@ -942,6 +942,8 @@
    debugindex    dump index data for a storage primitive
    debugindexdot
                  dump an index DAG as a graphviz dot file
+   debugindexstats
+                 show stats related to the changelog index
    debuginstall  test Mercurial installation
    debugknown    test whether node ids are known to a repo
    debuglocks    show or modify state of locks