OSDN Git Service

perf hists browser: Fix UI bug after zoom into thread/dso/symbol
authorHe Kuang <hekuang@huawei.com>
Wed, 11 Mar 2015 12:36:03 +0000 (20:36 +0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 12 Mar 2015 15:39:59 +0000 (12:39 -0300)
commita8cd1f4393032cd87e98803346865cdbceb15ad3
treebd307acae385cc29f7ea3abde9e4914f1c4f7d9f
parenta78604defffbc1da1497a8c8b48275b723eb5946
perf hists browser: Fix UI bug after zoom into thread/dso/symbol

When zoom into thread/dso/symbol, the fold/unfold stat is cleared in
hists__filter_by_thread/dso/symbol(), but h->nr_rows is not cleared. So
if we toggle fold stat on the unfold entires, nr_entries got a wrong
value.

This bug can be reproduced as follows:

$ perf record -g -e syscalls:sys_enter_open ls
$ perf report

    Children      Self  Command  Shared Object            Symbol
  ================================================================
  +   50.00%     0.00%  ls       ld64.so  [.]  _dl_get_ready_to_run
  -   50.00%     0.00%  ls       ld64.so  [.]  _dl_load_shared_library
      _dl_load_shared_library <= [Zoom into thread/dso]
      _dl_get_ready_to_run
      _start
  ...

In the new thread hists, all entries reset to fold, if we unfold the
same entry as we previously unfolded, nr_entries got wrong value, and we
can't move down cursor to bottom row.

                                                         Thread: ls
    Children      Self  Command  Shared Object            Symbol
  ================================================================
  +   50.00%     0.00%  ls       ld64.so  [.]  _dl_get_ready_to_run
  -   50.00%     0.00%  ls       ld64.so  [.]  _dl_load_shared_library
      _dl_load_shared_library
      _dl_get_ready_to_run <= [cursor may stop here, can't move down]
      _start
  ...

This patch clear h->nr_rows to fix this bug.

Signed-off-by: He Kuang <hekuang@huawei.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@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/1426077363-855-2-git-send-email-hekuang@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/hist.c