Patchwork D7109: dirstate: add some traces on listdir calls

login
register
mail settings
Submitter phabricator
Date Oct. 15, 2019, 3:23 p.m.
Message ID <differential-rev-PHID-DREV-zwogcjhw276vjqupi6sv-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/42362/
State Superseded
Headers show

Comments

phabricator - Oct. 15, 2019, 3:23 p.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I'm starting to spend some time trying to make `hg status` do less work, and
  knowing what's happening in here and what's expensive is an important start.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7109

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -16,6 +16,9 @@ 
 from .i18n import _
 from .node import nullid
 from .pycompat import delattr
+
+from hgdemandimport import tracing
+
 from . import (
     encoding,
     error,
@@ -951,6 +954,7 @@ 
         def traverse(work, alreadynormed):
             wadd = work.append
             while work:
+                tracing.counter('dirstate.walk work', len(work))
                 nd = work.pop()
                 visitentries = match.visitchildrenset(nd)
                 if not visitentries:
@@ -961,7 +965,8 @@ 
                 if nd != b'':
                     skip = b'.hg'
                 try:
-                    entries = listdir(join(nd), stat=True, skip=skip)
+                    with tracing.log('dirstate.walk.traverse listdir %s', nd):
+                        entries = listdir(join(nd), stat=True, skip=skip)
                 except OSError as inst:
                     if inst.errno in (errno.EACCES, errno.ENOENT):
                         match.bad(