libperf: Move perf_event_attr field from perf's evsel to libperf's perf_evsel

Move the perf_event_attr struct fron 'struct evsel' to 'struct perf_evsel'.

Committer notes:

Fixed up these:

 tools/perf/arch/arm/util/auxtrace.c
 tools/perf/arch/arm/util/cs-etm.c
 tools/perf/arch/arm64/util/arm-spe.c
 tools/perf/arch/s390/util/auxtrace.c
 tools/perf/util/cs-etm.c

Also

  cc1: warnings being treated as errors
  tests/sample-parsing.c: In function 'do_test':
  tests/sample-parsing.c:162: error: missing initializer
  tests/sample-parsing.c:162: error: (near initialization for 'evsel.core.cpus')

   	struct evsel evsel = {
   		.needs_swap = false,
  -		.core.attr = {
  -			.sample_type = sample_type,
  -			.read_format = read_format,
  +		.core = {
  +			. attr = {
  +				.sample_type = sample_type,
  +				.read_format = read_format,
  +			},

  [perfbuilder@a70e4eeb5549 /]$ gcc --version |& head -1
  gcc (GCC) 4.4.7

Also we don't need to include perf_event.h in
tools/perf/lib/include/perf/evsel.h, forward declaring 'struct
perf_event_attr' is enough. And this even fixes the build in some
systems where things are used somewhere down the include path from
perf_event.h without defining __always_inline.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20190721112506.12306-43-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Jiri Olsa
2019-07-21 13:24:29 +02:00
committed by Arnaldo Carvalho de Melo
parent 6484d2f9dc
commit 1fc632cef4
59 changed files with 864 additions and 857 deletions

View File

@@ -154,7 +154,7 @@ static bool perf_session__has_comm_exec(struct perf_session *session)
struct evsel *evsel;
evlist__for_each_entry(session->evlist, evsel) {
if (evsel->attr.comm_exec)
if (evsel->core.attr.comm_exec)
return true;
}
@@ -1210,7 +1210,7 @@ static void dump_sample(struct evsel *evsel, union perf_event *event,
event->header.misc, sample->pid, sample->tid, sample->ip,
sample->period, sample->addr);
sample_type = evsel->attr.sample_type;
sample_type = evsel->core.attr.sample_type;
if (evsel__has_callchain(evsel))
callchain__printf(evsel, sample);
@@ -1240,7 +1240,7 @@ static void dump_sample(struct evsel *evsel, union perf_event *event,
printf("... transaction: %" PRIx64 "\n", sample->transaction);
if (sample_type & PERF_SAMPLE_READ)
sample_read__printf(sample, evsel->attr.read_format);
sample_read__printf(sample, evsel->core.attr.read_format);
}
static void dump_read(struct evsel *evsel, union perf_event *event)
@@ -1258,7 +1258,7 @@ static void dump_read(struct evsel *evsel, union perf_event *event)
if (!evsel)
return;
read_format = evsel->attr.read_format;
read_format = evsel->core.attr.read_format;
if (read_format & PERF_FORMAT_TOTAL_TIME_ENABLED)
printf("... time enabled : %" PRIu64 "\n", read_event->time_enabled);
@@ -1355,8 +1355,8 @@ static int
struct machine *machine)
{
/* We know evsel != NULL. */
u64 sample_type = evsel->attr.sample_type;
u64 read_format = evsel->attr.read_format;
u64 sample_type = evsel->core.attr.sample_type;
u64 read_format = evsel->core.attr.read_format;
/* Standard sample delivery. */
if (!(sample_type & PERF_SAMPLE_READ))
@@ -1709,7 +1709,7 @@ perf_session__warn_order(const struct perf_session *session)
bool should_warn = true;
evlist__for_each_entry(session->evlist, evsel) {
if (evsel->attr.write_backward)
if (evsel->core.attr.write_backward)
should_warn = false;
}
@@ -2186,7 +2186,7 @@ bool perf_session__has_traces(struct perf_session *session, const char *msg)
struct evsel *evsel;
evlist__for_each_entry(session->evlist, evsel) {
if (evsel->attr.type == PERF_TYPE_TRACEPOINT)
if (evsel->core.attr.type == PERF_TYPE_TRACEPOINT)
return true;
}
@@ -2263,7 +2263,7 @@ struct evsel *perf_session__find_first_evtype(struct perf_session *session,
struct evsel *pos;
evlist__for_each_entry(session->evlist, pos) {
if (pos->attr.type == type)
if (pos->core.attr.type == type)
return pos;
}
return NULL;
@@ -2282,7 +2282,7 @@ int perf_session__cpu_bitmap(struct perf_session *session,
if (!evsel)
continue;
if (!(evsel->attr.sample_type & PERF_SAMPLE_CPU)) {
if (!(evsel->core.attr.sample_type & PERF_SAMPLE_CPU)) {
pr_err("File does not contain CPU events. "
"Remove -C option to proceed.\n");
return -1;