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


Groups > linux.kernel > #1338108

[PATCH 25/55] perf tools: Only validate is_pos for tracking evsels

From Wang Nan <wangnan0@huawei.com>
Newsgroups linux.kernel
Subject [PATCH 25/55] perf tools: Only validate is_pos for tracking evsels
Date 2016-02-19 13:00 +0100
Message-ID <r3RT5-4A8-41@gated-at.bofh.it> (permalink)
References <r3RJo-4w0-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


is_pos only useful for tracking events (fork, mmap, exit, ...).
Perf collects those events through evsel with 'tracking' set.
Therefore, there's no need to validate every is_pos against
evlist->is_pos.

This patch is required after perf support PERF_SAMPLE_TAILSIZE.
Since there an extra u64 at the end of this type of evsels, is_pos
for evsel with PERF_SAMPLE_TAILSIZE setting is different from other
evsels.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Signed-off-by: He Kuang <hekuang@huawei.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
---
 tools/perf/util/evlist.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index c42e196..fef465a 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -1274,8 +1274,15 @@ bool perf_evlist__valid_sample_type(struct perf_evlist *evlist)
 		return false;
 
 	evlist__for_each(evlist, pos) {
-		if (pos->id_pos != evlist->id_pos ||
-		    pos->is_pos != evlist->is_pos)
+		if (pos->id_pos != evlist->id_pos)
+			return false;
+		/*
+		 * Only tracking events needs is_pos. Those events are
+		 * collected if evsel->tracking is selected.
+		 * For other evsel, is_pos is useless for other evsels,
+		 * so skip validating them.
+		 */
+		if (pos->tracking && pos->is_pos != evlist->is_pos)
 			return false;
 	}
 
-- 
1.8.3.4

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


Thread

[PATCH 25/55] perf tools: Only validate is_pos for tracking evsels Wang Nan <wangnan0@huawei.com> - 2016-02-19 13:00 +0100

csiph-web