changeset 40381:4613f9274fc0

statprof: update the name as the i increases (issue6003) 2864f8d3fcd6 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. Differential Revision: https://phab.mercurial-scm.org/D5172
author Pulkit Goyal <pulkit@yandex-team.ru>
date Fri, 19 Oct 2018 23:30:56 +0300
parents 1ce4fe0603a6
children bd1ec1e36bf0
files mercurial/statprof.py tests/test-profile.t
diffstat 2 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/statprof.py	Fri Oct 19 23:18:29 2018 +0300
+++ b/mercurial/statprof.py	Fri Oct 19 23:30:56 2018 +0300
@@ -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)
 
--- a/tests/test-profile.t	Fri Oct 19 23:18:29 2018 +0300
+++ b/tests/test-profile.t	Fri Oct 19 23:30:56 2018 +0300
@@ -89,6 +89,8 @@
   $ hg --profile --config profiling.statformat=byline sleep 2>../out
   $ head -n 3 ../out
     %   cumulative      self          
+   time    seconds   seconds  name    
+   * sleepext.py:*:sleep (glob)
   $ cat ../out | statprofran
 
   $ hg --profile --config profiling.statformat=bymethod sleep 2>../out