# HG changeset patch # User Pulkit Goyal # Date 2018-10-19 20:30:56 # Node ID 4613f9274fc0ff8046011a2d889a27d38c4a2dd7 # Parent 1ce4fe0603a6fcc11c71482be3343663ec52041a 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 diff --git a/mercurial/statprof.py b/mercurial/statprof.py --- a/mercurial/statprof.py +++ b/mercurial/statprof.py @@ -664,6 +664,7 @@ def display_hotpath(data, fp, limit=0.05 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) 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 @@ Various statprof formatters work $ 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