From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: He Kuang <hekuang@huawei.com>
Cc: namhyung@kernel.org, a.p.zijlstra@chello.nl, paulus@samba.org,
mingo@redhat.com, jolsa@kernel.org, wangnan0@huawei.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCHv2 1/2] perf hists browser: Fix UI bug after fold/unfold
Date: Wed, 11 Mar 2015 10:48:03 -0300 [thread overview]
Message-ID: <20150311134803.GF29070@kernel.org> (raw)
In-Reply-To: <1426077363-855-1-git-send-email-hekuang@huawei.com>
Em Wed, Mar 11, 2015 at 08:36:02PM +0800, He Kuang escreveu:
> 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.
Two nits below:
> Signed-off-by: He Kuang <hekuang@huawei.com>
> ---
> tools/perf/ui/browsers/hists.c | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
> index 1106bb8..bef9ab0 100644
> --- a/tools/perf/ui/browsers/hists.c
> +++ b/tools/perf/ui/browsers/hists.c
> @@ -42,6 +42,7 @@ static void hist_browser__update_nr_entries(struct hist_browser *hb);
>
> static struct rb_node *hists__filter_entries(struct rb_node *nd,
> float min_pcnt);
> +static int __hist_browser__get_folding(struct hist_browser *browser);
Why not move the whole function body to...
>
> static bool hist_browser__has_filter(struct hist_browser *hb)
> {
Just before the only caller, i.e. here and...
> @@ -57,6 +58,7 @@ static u32 hist_browser__nr_entries(struct hist_browser *hb)
> else
> nr_entries = hb->hists->nr_entries;
>
> + hb->nr_callchain_rows = __hist_browser__get_folding(hb);
> return nr_entries + hb->nr_callchain_rows;
> }
>
> @@ -353,6 +355,24 @@ static void hist_entry__set_folding(struct hist_entry *he, bool unfold)
> he->nr_rows = 0;
> }
>
> +static int
> +__hist_browser__get_folding(struct hist_browser *browser)
Why use the __ prefix since there is no hist_browser__get_folding that
calls it and does something more?
Summary: please rename it to hist_browser__get_folding() and move it to
just before its only caller.
Also, besides these nits, are you Ok with this now Namhyung?
Thanks a lot for working on this!
- Arnaldo
> +{
> + struct rb_node *nd;
> + struct hists *hists = browser->hists;
> + int unfolded_rows = 0;
> +
> + for (nd = rb_first(&hists->entries);
> + (nd = hists__filter_entries(nd, browser->min_pcnt)) != NULL;
> + nd = rb_next(nd)) {
> + struct hist_entry *he = rb_entry(nd, struct hist_entry, rb_node);
> +
> + if (he->ms.unfolded)
> + unfolded_rows += he->nr_rows;
> + }
> + return unfolded_rows;
> +}
> +
> static void
> __hist_browser__set_folding(struct hist_browser *browser, bool unfold)
> {
> --
> 2.2.0.33.gc18b867
next prev parent reply other threads:[~2015-03-11 13:47 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-06 12:51 [PATCH] perf hists browser: Fix UI bug after fold/unfold He Kuang
2015-03-10 6:28 ` Namhyung Kim
2015-03-10 7:26 ` He Kuang
2015-03-11 0:26 ` Namhyung Kim
2015-03-11 12:36 ` [PATCHv2 1/2] " He Kuang
2015-03-11 12:36 ` [PATCHv2 2/2] perf hists browser: Fix UI bug after zoom into thread/dso/symbol He Kuang
2015-03-11 14:12 ` Arnaldo Carvalho de Melo
2015-03-12 8:05 ` Namhyung Kim
2015-03-14 7:04 ` [tip:perf/core] " tip-bot for He Kuang
2015-03-11 13:48 ` Arnaldo Carvalho de Melo [this message]
2015-03-12 7:21 ` [PATCHv3] perf hists browser: Fix UI bug after fold/unfold He Kuang
2015-03-12 7:51 ` Namhyung Kim
2015-03-12 16:19 ` Arnaldo Carvalho de Melo
2015-03-14 7:05 ` [tip:perf/core] " tip-bot for He Kuang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150311134803.GF29070@kernel.org \
--to=acme@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=hekuang@huawei.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=paulus@samba.org \
--cc=wangnan0@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.