D5172: statprof: update the name as the i increases (issue6003)

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Fri Oct 19 20:35:18 UTC 2018


pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  https://phab.mercurial-scm.org/rHG2864f8d3fcd6749d6ebba725a58717f42e52971b while working on py3 fix, take out the name building out of the
  loop so we were not building the new stack-name for each i, rather we were using
  the first one again and again.
  
  The test changes shows the profile is now working.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/statprof.py
  tests/test-profile.t

CHANGE DETAILS

diff --git a/tests/test-profile.t b/tests/test-profile.t
--- a/tests/test-profile.t
+++ b/tests/test-profile.t
@@ -89,6 +89,8 @@
   $ hg --profile --config profiling.statformat=byline sleep 2>../out
   $ head -n 3 ../out
     %   cumulative      self          
+   time    seconds   seconds  name    
+   92.55      0.02      0.02  sleepext.py:7:sleep
   $ cat ../out | statprofran
 
   $ hg --profile --config profiling.statformat=bymethod sleep 2>../out
diff --git a/mercurial/statprof.py b/mercurial/statprof.py
--- a/mercurial/statprof.py
+++ b/mercurial/statprof.py
@@ -664,6 +664,7 @@
                 name = r'%s:%s' % (stack[i].filename(), stack[i].function)
                 while i < len(stack) and name in skips:
                     i += 1
+                    name = r'%s:%s' % (stack[i].filename(), stack[i].function)
                 if i < len(stack):
                     child.add(stack[i:], time)
 



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


More information about the Mercurial-devel mailing list