summaryrefslogtreecommitdiffstats
path: root/tools/perf/util
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2016-03-09 22:46:56 +0900
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-03-10 16:45:36 -0300
commitf4954cfb1cda4cf0abf36d23213c702e94666c3f (patch)
treea499753a085083b2b6599ded1aadae8fce74aabe /tools/perf/util
parente12b202f8fb9b62a3997cad8e93401f85293390c (diff)
downloadtalos-obmc-linux-f4954cfb1cda4cf0abf36d23213c702e94666c3f.tar.gz
talos-obmc-linux-f4954cfb1cda4cf0abf36d23213c702e94666c3f.zip
perf tools: Fix hist_entry__filter() for hierarchy
When hierarchy mode is enabled each output format is in a separate hpp list. So when applying a 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> Tested-by: Jiri Olsa <jolsa@kernel.org> Cc: Andi Kleen <andi@firstfloor.org> Cc: David Ahern <dsahern@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/r/1457531222-18130-2-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util')
-rw-r--r--tools/perf/util/sort.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 59a101e43457..8a49a07ebea6 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 (!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 if any of sort key in the hpp list
+ * is applied. But it should skip non-matched filter types.
+ */
+ r = hse->se->se_filter(he, type, arg);
+ if (r >= 0) {
+ if (ret < 0)
+ ret = 0;
+ ret |= r;
+ }
+ }
+
+ return ret;
}
static int __sort_dimension__add_hpp_sort(struct sort_dimension *sd,
OpenPOWER on IntegriCloud