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
--- 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