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>
72 lines
1.5 KiB
C
72 lines
1.5 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* auxtrace.c: AUX area tracing support
|
|
* Copyright (c) 2013-2014, Intel Corporation.
|
|
*/
|
|
|
|
#include <errno.h>
|
|
#include <stdbool.h>
|
|
|
|
#include "../../util/header.h"
|
|
#include "../../util/debug.h"
|
|
#include "../../util/pmu.h"
|
|
#include "../../util/auxtrace.h"
|
|
#include "../../util/intel-pt.h"
|
|
#include "../../util/intel-bts.h"
|
|
#include "../../util/evlist.h"
|
|
|
|
static
|
|
struct auxtrace_record *auxtrace_record__init_intel(struct evlist *evlist,
|
|
int *err)
|
|
{
|
|
struct perf_pmu *intel_pt_pmu;
|
|
struct perf_pmu *intel_bts_pmu;
|
|
struct evsel *evsel;
|
|
bool found_pt = false;
|
|
bool found_bts = false;
|
|
|
|
intel_pt_pmu = perf_pmu__find(INTEL_PT_PMU_NAME);
|
|
intel_bts_pmu = perf_pmu__find(INTEL_BTS_PMU_NAME);
|
|
|
|
evlist__for_each_entry(evlist, evsel) {
|
|
if (intel_pt_pmu && evsel->core.attr.type == intel_pt_pmu->type)
|
|
found_pt = true;
|
|
if (intel_bts_pmu && evsel->core.attr.type == intel_bts_pmu->type)
|
|
found_bts = true;
|
|
}
|
|
|
|
if (found_pt && found_bts) {
|
|
pr_err("intel_pt and intel_bts may not be used together\n");
|
|
*err = -EINVAL;
|
|
return NULL;
|
|
}
|
|
|
|
if (found_pt)
|
|
return intel_pt_recording_init(err);
|
|
|
|
if (found_bts)
|
|
return intel_bts_recording_init(err);
|
|
|
|
return NULL;
|
|
}
|
|
|
|
struct auxtrace_record *auxtrace_record__init(struct evlist *evlist,
|
|
int *err)
|
|
{
|
|
char buffer[64];
|
|
int ret;
|
|
|
|
*err = 0;
|
|
|
|
ret = get_cpuid(buffer, sizeof(buffer));
|
|
if (ret) {
|
|
*err = ret;
|
|
return NULL;
|
|
}
|
|
|
|
if (!strncmp(buffer, "GenuineIntel,", 13))
|
|
return auxtrace_record__init_intel(evlist, err);
|
|
|
|
return NULL;
|
|
}
|