[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180124115143.14322-2-jolsa@kernel.org>
Date: Wed, 24 Jan 2018 12:51:23 +0100
From: Jiri Olsa <jolsa@...nel.org>
To: Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Ingo Molnar <mingo@...nel.org>
Cc: lkml <linux-kernel@...r.kernel.org>,
Namhyung Kim <namhyung@...nel.org>,
David Ahern <dsahern@...il.com>,
Andi Kleen <ak@...ux.intel.com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Andy Lutomirski <luto@...capital.net>,
Arnaldo Carvalho de Melo <acme@...nel.org>
Subject: [PATCH 01/21] perf tools: Add perf_evsel__is_sample_bit function
Adding perf_evsel__is_sample_bit function to check on the
evsel's sample_type bit. It will be used later in the patchset.
Link: http://lkml.kernel.org/n/tip-woz5sp8qxvnhz8h14ne0657g@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@...nel.org>
---
tools/perf/util/evsel.c | 6 ++++++
tools/perf/util/evsel.h | 5 +++++
2 files changed, 11 insertions(+)
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 66fa45198a11..0f62de48594e 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -183,6 +183,12 @@ void perf_evsel__calc_id_pos(struct perf_evsel *evsel)
evsel->is_pos = __perf_evsel__calc_is_pos(evsel->attr.sample_type);
}
+bool __perf_evsel__is_sample_bit(struct perf_evsel *evsel,
+ enum perf_event_sample_format bit)
+{
+ return evsel->attr.sample_type & bit;
+}
+
void __perf_evsel__set_sample_bit(struct perf_evsel *evsel,
enum perf_event_sample_format bit)
{
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 846e41644525..e54ea37469b3 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -234,11 +234,16 @@ int perf_evsel__group_desc(struct perf_evsel *evsel, char *buf, size_t size);
int perf_evsel__alloc_id(struct perf_evsel *evsel, int ncpus, int nthreads);
void perf_evsel__close_fd(struct perf_evsel *evsel);
+bool __perf_evsel__is_sample_bit(struct perf_evsel *evsel,
+ enum perf_event_sample_format bit);
void __perf_evsel__set_sample_bit(struct perf_evsel *evsel,
enum perf_event_sample_format bit);
void __perf_evsel__reset_sample_bit(struct perf_evsel *evsel,
enum perf_event_sample_format bit);
+#define perf_evsel__is_sample_bit(evsel, bit) \
+ __perf_evsel__is_sample_bit(evsel, PERF_SAMPLE_##bit)
+
#define perf_evsel__set_sample_bit(evsel, bit) \
__perf_evsel__set_sample_bit(evsel, PERF_SAMPLE_##bit)
--
2.13.6
Powered by blists - more mailing lists