From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Jiri Olsa <jolsa@kernel.org>, LKML <linux-kernel@vger.kernel.org>,
David Ahern <dsahern@gmail.com>, Andi Kleen <andi@firstfloor.org>,
Stephane Eranian <eranian@google.com>,
Wang Nan <wangnan0@huawei.com>
Subject: Re: [PATCH 4/4] perf hists browser: Add 'L' key to change percent limit
Date: Wed, 3 Feb 2016 12:13:37 -0300 [thread overview]
Message-ID: <20160203151337.GA10893@kernel.org> (raw)
In-Reply-To: <1454508683-5735-4-git-send-email-namhyung@kernel.org>
Em Wed, Feb 03, 2016 at 11:11:23PM +0900, Namhyung Kim escreveu:
> Add 'L' key action to change the percent limit applied to both of hist
> entries and callchains.
Thanks a lot, works like a charm!
Applied,
- Arnaldo
> Suggested-by: Arnaldo Carvalho de Melo <acme@kernel.org>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
> tools/perf/ui/browsers/hists.c | 55 ++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 55 insertions(+)
>
> diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
> index 61d578bf4ffd..c6ae69716002 100644
> --- a/tools/perf/ui/browsers/hists.c
> +++ b/tools/perf/ui/browsers/hists.c
> @@ -2029,6 +2029,42 @@ static void hist_browser__update_nr_entries(struct hist_browser *hb)
> hb->nr_non_filtered_entries = nr_entries;
> }
>
> +static void hist_browser__update_percent_limit(struct hist_browser *hb,
> + double percent)
> +{
> + struct hist_entry *he;
> + struct rb_node *nd = rb_first(&hb->hists->entries);
> + u64 total = hists__total_period(hb->hists);
> + u64 min_callchain_hits = total * (percent / 100);
> +
> + hb->min_pcnt = callchain_param.min_percent = percent;
> +
> + if (!symbol_conf.use_callchain)
> + return;
> +
> + while ((nd = hists__filter_entries(nd, hb->min_pcnt)) != NULL) {
> + he = rb_entry(nd, struct hist_entry, rb_node);
> +
> + if (callchain_param.mode == CHAIN_GRAPH_REL) {
> + total = he->stat.period;
> +
> + if (symbol_conf.cumulate_callchain)
> + total = he->stat_acc->period;
> +
> + min_callchain_hits = total * (percent / 100);
> + }
> +
> + callchain_param.sort(&he->sorted_chain, he->callchain,
> + min_callchain_hits, &callchain_param);
> +
> + /* force to re-evaluate folding state of callchains */
> + he->init_have_children = false;
> + hist_entry__set_folding(he, false);
> +
> + nd = rb_next(nd);
> + }
> +}
> +
> static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
> const char *helpline,
> bool left_exits,
> @@ -2064,6 +2100,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
> "E Expand all callchains\n" \
> "F Toggle percentage of filtered entries\n" \
> "H Display column headers\n" \
> + "L Change percent limit\n" \
> "m Display context menu\n" \
> "S Zoom into current Processor Socket\n" \
>
> @@ -2219,6 +2256,24 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
> top->zero = !top->zero;
> }
> continue;
> + case 'L':
> + if (ui_browser__input_window("Percent Limit",
> + "Please enter the value you want to hide entries under that percent.",
> + buf, "ENTER: OK, ESC: Cancel",
> + delay_secs * 2) == K_ENTER) {
> + char *end;
> + double new_percent = strtod(buf, &end);
> +
> + if (new_percent < 0 || new_percent > 100) {
> + ui_browser__warning(&browser->b, delay_secs * 2,
> + "Invalid percent: %.2f", new_percent);
> + continue;
> + }
> +
> + hist_browser__update_percent_limit(browser, new_percent);
> + hist_browser__reset(browser);
> + }
> + continue;
> case K_F1:
> case 'h':
> case '?':
> --
> 2.7.0
next prev parent reply other threads:[~2016-02-03 15:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-03 14:11 [PATCH 1/4] perf report: Update document of --sort option Namhyung Kim
2016-02-03 14:11 ` [PATCH 2/4] perf report: Update document of --percent-limit option Namhyung Kim
2016-02-04 12:42 ` [tip:perf/core] perf report: Update documention " tip-bot for Namhyung Kim
2016-02-03 14:11 ` [RFC/PATCH 3/4] perf tools: Change default calchain percent limit to 0.05% Namhyung Kim
2016-02-03 14:11 ` [PATCH 4/4] perf hists browser: Add 'L' key to change percent limit Namhyung Kim
2016-02-03 15:13 ` Arnaldo Carvalho de Melo [this message]
2016-02-04 12:43 ` [tip:perf/core] perf hists browser: Add 'L' hotkey " tip-bot for Namhyung Kim
2016-02-04 12:42 ` [tip:perf/core] perf report: Update documentation of --sort option tip-bot for Namhyung Kim
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=20160203151337.GA10893@kernel.org \
--to=acme@kernel.org \
--cc=andi@firstfloor.org \
--cc=dsahern@gmail.com \
--cc=eranian@google.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.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.