From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@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: [PATCH 1/6] perf tools: Fix hist_entry__filter() for hierarchy
Date: Wed, 9 Mar 2016 00:06:38 +0900 [thread overview]
Message-ID: <1457449603-7124-1-git-send-email-namhyung@kernel.org> (raw)
When hierarchy mode is enabled each output format is in a separate hpp
list. So when applying filter it should check all formats in the list.
Currently it only checks a single ->fmt field which was not set properly.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/sort.c | 28 +++++++++++++++++++++-------
1 file changed, 21 insertions(+), 7 deletions(-)
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 041f236379e0..2e803847046c 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -1602,16 +1602,30 @@ int hist_entry__filter(struct hist_entry *he, int type, const void *arg)
{
struct perf_hpp_fmt *fmt;
struct hpp_sort_entry *hse;
+ int ret = -1;
+ int r;
- fmt = he->fmt;
- if (fmt == NULL || !perf_hpp__is_sort_entry(fmt))
- return -1;
+ perf_hpp_list__for_each_format(he->hpp_list, fmt) {
+ if (fmt == NULL || !perf_hpp__is_sort_entry(fmt))
+ continue;
- hse = container_of(fmt, struct hpp_sort_entry, hpp);
- if (hse->se->se_filter == NULL)
- return -1;
+ hse = container_of(fmt, struct hpp_sort_entry, hpp);
+ if (hse->se->se_filter == NULL)
+ continue;
- return hse->se->se_filter(he, type, arg);
+ /*
+ * hist entry is filtered when all sort keys in the hpp list
+ * is applied. So if any sort key returns 0, it will *NOT*
+ * filtered out.
+ */
+ r = hse->se->se_filter(he, type, arg);
+ if (r == 0)
+ return 0;
+ if (r > 0)
+ ret = 1;
+ }
+
+ return ret;
}
static int __sort_dimension__add_hpp_sort(struct sort_dimension *sd, int level)
--
2.7.2
next reply other threads:[~2016-03-08 15:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-08 15:06 Namhyung Kim [this message]
2016-03-08 15:06 ` [PATCH 2/6] perf tools: Add more sort entry check functions Namhyung Kim
2016-03-08 15:06 ` [PATCH 3/6] perf tools: Fix command line filters in hierarchy mode Namhyung Kim
2016-03-09 9:13 ` Jiri Olsa
2016-03-09 12:44 ` Namhyung Kim
2016-03-08 15:06 ` [PATCH 4/6] perf tools: Remove hist_entry->fmt field Namhyung Kim
2016-03-08 15:06 ` [PATCH 5/6] perf hists browser: Cleanup hist_browser__fprintf_hierarchy_entry() Namhyung Kim
2016-03-08 15:06 ` [PATCH 6/6] perf tools: Remove nr_sort_keys field 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=1457449603-7124-1-git-send-email-namhyung@kernel.org \
--to=namhyung@kernel.org \
--cc=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=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