From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, Namhyung Kim <namhyung@kernel.org>,
Andi Kleen <andi@firstfloor.org>, David Ahern <dsahern@gmail.com>,
Jiri Olsa <jolsa@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Stephane Eranian <eranian@google.com>,
Wang Nan <wangnan0@huawei.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 09/19] perf hists browser: Show message for percent limit
Date: Fri, 26 Feb 2016 20:18:21 -0300 [thread overview]
Message-ID: <1456528711-13793-10-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1456528711-13793-1-git-send-email-acme@kernel.org>
From: Namhyung Kim <namhyung@kernel.org>
Like the stdio, it should show messages about omitted hierarchy entries.
Please refer the previous commit for more details.
As it needs to check an entry is omitted or not multiple times, add the
has_no_entry field in the hist entry.
Suggested-and-Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1456488800-28124-4-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/ui/browsers/hists.c | 99 ++++++++++++++++++++++++++++++++++++++++++
tools/perf/util/hist.c | 2 +
tools/perf/util/sort.h | 1 +
3 files changed, 102 insertions(+)
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 904eaa719eb3..71c6d510390f 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -260,6 +260,9 @@ static int hierarchy_count_rows(struct hist_browser *hb, struct hist_entry *he,
if (he->leaf)
return callchain__count_rows(&he->sorted_chain);
+ if (he->has_no_entry)
+ return 1;
+
node = rb_first(&he->hroot_out);
while (node) {
float percent;
@@ -409,10 +412,18 @@ static bool hist_browser__toggle_fold(struct hist_browser *browser)
/* account grand children */
if (symbol_conf.report_hierarchy)
browser->b.nr_entries += child_rows - he->nr_rows;
+
+ if (!he->leaf && he->nr_rows == 0) {
+ he->has_no_entry = true;
+ he->nr_rows = 1;
+ }
} else {
if (symbol_conf.report_hierarchy)
browser->b.nr_entries -= child_rows - he->nr_rows;
+ if (he->has_no_entry)
+ he->has_no_entry = false;
+
he->nr_rows = 0;
}
@@ -545,6 +556,12 @@ __hist_browser__set_folding(struct hist_browser *browser, bool unfold)
browser->nr_hierarchy_entries++;
if (he->leaf)
browser->nr_callchain_rows += he->nr_rows;
+ else if (unfold && !hist_entry__has_hierarchy_children(he, browser->min_pcnt)) {
+ browser->nr_hierarchy_entries++;
+ he->has_no_entry = true;
+ he->nr_rows = 1;
+ } else
+ he->has_no_entry = false;
}
}
@@ -1412,6 +1429,75 @@ show_callchain:
return printed;
}
+static int hist_browser__show_no_entry(struct hist_browser *browser,
+ unsigned short row,
+ int level, int nr_sort_keys)
+{
+ int width = browser->b.width;
+ bool current_entry = ui_browser__is_current_entry(&browser->b, row);
+ bool first = true;
+ int column = 0;
+ int ret;
+ struct perf_hpp_fmt *fmt;
+
+ if (current_entry) {
+ browser->he_selection = NULL;
+ browser->selection = NULL;
+ }
+
+ hist_browser__gotorc(browser, row, 0);
+
+ if (current_entry && browser->b.navkeypressed)
+ ui_browser__set_color(&browser->b, HE_COLORSET_SELECTED);
+ else
+ ui_browser__set_color(&browser->b, HE_COLORSET_NORMAL);
+
+ ui_browser__write_nstring(&browser->b, "", level * HIERARCHY_INDENT);
+ width -= level * HIERARCHY_INDENT;
+
+ hists__for_each_format(browser->hists, fmt) {
+ if (perf_hpp__should_skip(fmt, browser->hists) ||
+ column++ < browser->b.horiz_scroll)
+ continue;
+
+ if (perf_hpp__is_sort_entry(fmt) ||
+ perf_hpp__is_dynamic_entry(fmt))
+ break;
+
+ ret = fmt->width(fmt, NULL, hists_to_evsel(browser->hists));
+
+ if (first) {
+ /* for folded sign */
+ first = false;
+ ret++;
+ } else {
+ /* space between columns */
+ ret += 2;
+ }
+
+ ui_browser__write_nstring(&browser->b, "", ret);
+ width -= ret;
+ }
+
+ ui_browser__write_nstring(&browser->b, "", nr_sort_keys * HIERARCHY_INDENT);
+ width -= nr_sort_keys * HIERARCHY_INDENT;
+
+ if (column >= browser->b.horiz_scroll) {
+ char buf[32];
+
+ ret = snprintf(buf, sizeof(buf), "no entry >= %.2f%%", browser->min_pcnt);
+ ui_browser__printf(&browser->b, " %s", buf);
+ width -= ret + 2;
+ }
+
+ /* The scroll bar isn't being used */
+ if (!browser->b.navkeypressed)
+ width += 1;
+
+ ui_browser__write_nstring(&browser->b, "", width);
+ return 1;
+}
+
static int advance_hpp_check(struct perf_hpp *hpp, int inc)
{
advance_hpp(hpp, inc);
@@ -1575,6 +1661,14 @@ static unsigned int hist_browser__refresh(struct ui_browser *browser)
row += hist_browser__show_hierarchy_entry(hb, h, row,
h->depth,
nr_sort);
+ if (row == browser->rows)
+ break;
+
+ if (h->has_no_entry) {
+ hist_browser__show_no_entry(hb, row, h->depth,
+ nr_sort);
+ row++;
+ }
} else {
row += hist_browser__show_entry(hb, h, row);
}
@@ -2461,6 +2555,11 @@ static void hist_browser__update_percent_limit(struct hist_browser *hb,
while ((nd = hists__filter_entries(nd, hb->min_pcnt)) != NULL) {
he = rb_entry(nd, struct hist_entry, rb_node);
+ if (he->has_no_entry) {
+ he->has_no_entry = false;
+ he->nr_rows = 0;
+ }
+
if (!he->leaf || !symbol_conf.use_callchain)
goto next;
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index e71691977a95..75dc41d2dca9 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -1625,6 +1625,7 @@ static void hists__remove_entry_filter(struct hists *hists, struct hist_entry *h
/* force fold unfiltered entry for simplicity */
parent->unfolded = false;
+ parent->has_no_entry = false;
parent->row_offset = 0;
parent->nr_rows = 0;
next:
@@ -1637,6 +1638,7 @@ next:
/* force fold unfiltered entry for simplicity */
h->unfolded = false;
+ h->has_no_entry = false;
h->row_offset = 0;
h->nr_rows = 0;
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index a8d53ffe0916..25a5529a94e4 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -117,6 +117,7 @@ struct hist_entry {
bool init_have_children;
bool unfolded;
bool has_children;
+ bool has_no_entry;
};
};
char *srcline;
--
2.5.0
next prev parent reply other threads:[~2016-02-26 23:20 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-26 23:18 [GIT PULL 00/19] perf/core improvements and fixes Arnaldo Carvalho de Melo
2016-02-26 23:18 ` [PATCH 01/19] perf tools: Use asprintf() for simple string formatting/allocation Arnaldo Carvalho de Melo
2016-02-26 23:18 ` [PATCH 02/19] perf jvmti: improve error message in Makefile Arnaldo Carvalho de Melo
2016-02-26 23:18 ` [PATCH 03/19] perf tools: Fix parsing of pmu events with empty list of modifiers Arnaldo Carvalho de Melo
2016-02-26 23:18 ` [PATCH 04/19] perf script: Exception handling when the print fmt is empty Arnaldo Carvalho de Melo
2016-02-26 23:18 ` [PATCH 05/19] perf script: Remove duplicated code and needless script_spec__findnew() Arnaldo Carvalho de Melo
2016-02-26 23:18 ` [PATCH 06/19] perf hists: Add more helper functions for the hierarchy mode Arnaldo Carvalho de Melo
2016-02-26 23:18 ` [PATCH 07/19] perf report: Show message for percent limit on stdio Arnaldo Carvalho de Melo
2016-02-26 23:18 ` [PATCH 08/19] perf hists browser: Cleanup hist_browser__update_percent_limit() Arnaldo Carvalho de Melo
2016-02-26 23:18 ` Arnaldo Carvalho de Melo [this message]
2016-02-26 23:18 ` [PATCH 10/19] perf report: Show message for percent limit on gtk Arnaldo Carvalho de Melo
2016-02-26 23:18 ` [PATCH 11/19] perf hists: Fix comparing of dynamic entries Arnaldo Carvalho de Melo
2016-02-26 23:18 ` [PATCH 12/19] perf report: Fix indentation of dynamic entries in hierarchy Arnaldo Carvalho de Melo
2016-02-26 23:18 ` [PATCH 13/19] perf report: Left align " Arnaldo Carvalho de Melo
2016-02-26 23:18 ` [PATCH 14/19] perf hists: Fix dynamic entry display " Arnaldo Carvalho de Melo
2016-02-26 23:18 ` [PATCH 15/19] perf report: Update column width of dynamic entries Arnaldo Carvalho de Melo
2016-02-26 23:18 ` [PATCH 16/19] perf config: Bring perf_default_config to the very beginning at main() Arnaldo Carvalho de Melo
2016-02-26 23:18 ` [PATCH 17/19] perf tools: Only set filter for tracepoints events Arnaldo Carvalho de Melo
2016-02-26 23:18 ` [PATCH 18/19] perf trace: Call bpf__apply_obj_config in 'perf trace' Arnaldo Carvalho de Melo
2016-02-26 23:18 ` [PATCH 19/19] perf trace: Print content of bpf-output event Arnaldo Carvalho de Melo
2016-02-27 9:36 ` [GIT PULL 00/19] perf/core improvements and fixes Ingo Molnar
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=1456528711-13793-10-git-send-email-acme@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).