Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1354141

[PATCH v2 1/7] perf tools: Fix hist_entry__filter() for hierarchy

From Namhyung Kim <namhyung@kernel.org>
Newsgroups linux.kernel
Subject [PATCH v2 1/7] perf tools: Fix hist_entry__filter() for hierarchy
Date 2016-03-09 14:50 +0100
Message-ID <raMEX-9f-29@gated-at.bofh.it> (permalink)
References <raMEW-9f-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View 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..c3c823377d39 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, int level)
-- 
2.7.2

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCHSET 0/7] perf tools: Fix and cleanups for hierarchy mode (v2) Namhyung Kim <namhyung@kernel.org> - 2016-03-09 14:50 +0100
  [PATCH v2 5/7] perf hists browser: Cleanup hist_browser__fprintf_hierarchy_entry() Namhyung Kim <namhyung@kernel.org> - 2016-03-09 14:50 +0100
    [tip:perf/core] perf hists browser: Cleanup  hist_browser__fprintf_hierarchy_entry() tip-bot for Namhyung Kim <tipbot@zytor.com> - 2016-03-11 10:00 +0100
  [PATCH v2 7/7] perf tools: Recalc total periods using top-level entries in hierarchy Namhyung Kim <namhyung@kernel.org> - 2016-03-09 14:50 +0100
    [tip:perf/core] perf tools: Recalc total periods using top-level  entries in hierarchy tip-bot for Namhyung Kim <tipbot@zytor.com> - 2016-03-11 10:00 +0100
  [PATCH v2 1/7] perf tools: Fix hist_entry__filter() for hierarchy Namhyung Kim <namhyung@kernel.org> - 2016-03-09 14:50 +0100
    [tip:perf/core] perf tools: Fix hist_entry__filter() for hierarchy tip-bot for Namhyung Kim <tipbot@zytor.com> - 2016-03-11 09:50 +0100
  [PATCH v2 3/7] perf tools: Fix command line filters in hierarchy mode Namhyung Kim <namhyung@kernel.org> - 2016-03-09 15:00 +0100
    [tip:perf/core] perf tools: Fix command line filters in hierarchy  mode tip-bot for Namhyung Kim <tipbot@zytor.com> - 2016-03-11 09:50 +0100
  [PATCH v2 4/7] perf tools: Remove hist_entry->fmt field Namhyung Kim <namhyung@kernel.org> - 2016-03-09 15:00 +0100
    [tip:perf/core] perf tools: Remove hist_entry->fmt field tip-bot for Namhyung Kim <tipbot@zytor.com> - 2016-03-11 10:00 +0100
  Re: [PATCHSET 0/7] perf tools: Fix and cleanups for hierarchy mode  (v2) Jiri Olsa <jolsa@redhat.com> - 2016-03-10 11:40 +0100

csiph-web