perf hists browser: Fix UI bug after fold/unfold
In perf hists browser, the fold/unfold stat of each hist entry is
recorded but hb->nr_callchain_rows loses its value after zoom out and
zoom in back. This causes a wrong row cursor range that restrict user to
move down anymore.
This bug can be reproduced as follows:
$ perf record -g -e syscalls:* ls
$ perf report
Available samples
================================================================
2 syscalls:sys_enter_mprotect <= [enter one of the entries]
2 syscalls:sys_exit_mprotect
13 syscalls:sys_enter_brk
...
In the hists brower, unfold some of the items, now the cursor can reach
to any rows:
Children Self Command Shared Object Symbol
================================================================
- 100.00% 100.00% ls libuClibc-0.9.33.2.so [.] lstat64
- lstat64
16.67% 0x6469702e64
8.33% 0x646970
8.33% 0x617461
8.33% 0x65
- 16.67% 0.00% ls [unknown] [.]0x6469702e64
0x6469702e64 <= [cursor can reach to bottom line, everything is ok]
Now, zoom back to "Available samples" and enter again:
Children Self Command Shared Object Symbol
================================================================
- 100.00% 100.00% ls libuClibc-0.9.33.2.so [.] lstat64
- lstat64
16.67% 0x6469702e64
8.33% 0x646970
8.33% 0x617461 <= [cursor may stop here, can't move down anymore]
8.33% 0x65
- 16.67% 0.00% ls [unknown] [.]0x6469702e64
0x6469702e64
This patch recalculates hb->nr_callchain_rows to fix the bug.
Signed-off-by: He Kuang <hekuang@huawei.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1426144909-18951-1-git-send-email-hekuang@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>