[PATCH RFC 09/10] perf,tools: don't validate non-sample event

From: kan . liang
Date: Tue Aug 18 2015 - 12:42:50 EST


From: Kan Liang <kan.liang@xxxxxxxxx>

Stat event (:N) doesn't do sampling. So perf tool should not validate
its sample_type, read_format and sample_id_all.

Signed-off-by: Kan Liang <kan.liang@xxxxxxxxx>
---
tools/perf/util/evlist.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index ca7bf8d..fc2da23 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -1249,6 +1249,8 @@ bool perf_evlist__valid_sample_type(struct perf_evlist *evlist)
return false;

evlist__for_each(evlist, pos) {
+ if (!pos->attr.sample_type)
+ continue;
if (pos->id_pos != evlist->id_pos ||
pos->is_pos != evlist->is_pos)
return false;
@@ -1293,6 +1295,8 @@ bool perf_evlist__valid_read_format(struct perf_evlist *evlist)
u64 sample_type = first->attr.sample_type;

evlist__for_each(evlist, pos) {
+ if (!pos->attr.sample_type)
+ continue;
if (read_format != pos->attr.read_format)
return false;
}
@@ -1350,6 +1354,8 @@ bool perf_evlist__valid_sample_id_all(struct perf_evlist *evlist)
struct perf_evsel *first = perf_evlist__first(evlist), *pos = first;

evlist__for_each_continue(evlist, pos) {
+ if (!pos->attr.sample_type)
+ continue;
if (first->attr.sample_id_all != pos->attr.sample_id_all)
return false;
}
--
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/