aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/lib
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2019-07-21 07:24:29 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2019-07-29 17:34:45 -0400
commit1fc632cef4ea137bc45fd0fc4cb902e374064163 (patch)
tree71f8a47f40071eaee25d2157fc908f1f789c09a2 /tools/perf/lib
parent6484d2f9dc3ecbf13f07100f7f771d1d779eda04 (diff)
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>
Diffstat (limited to 'tools/perf/lib')
-rw-r--r--tools/perf/lib/evsel.c3
-rw-r--r--tools/perf/lib/include/internal/evsel.h4
-rw-r--r--tools/perf/lib/include/perf/evsel.h4
3 files changed, 9 insertions, 2 deletions
diff --git a/tools/perf/lib/evsel.c b/tools/perf/lib/evsel.c
index 9a87e867a7ec..17cba35becc7 100644
--- a/tools/perf/lib/evsel.c
+++ b/tools/perf/lib/evsel.c
@@ -3,7 +3,8 @@
3#include <linux/list.h> 3#include <linux/list.h>
4#include <internal/evsel.h> 4#include <internal/evsel.h>
5 5
6void perf_evsel__init(struct perf_evsel *evsel) 6void perf_evsel__init(struct perf_evsel *evsel, struct perf_event_attr *attr)
7{ 7{
8 INIT_LIST_HEAD(&evsel->node); 8 INIT_LIST_HEAD(&evsel->node);
9 evsel->attr = *attr;
9} 10}
diff --git a/tools/perf/lib/include/internal/evsel.h b/tools/perf/lib/include/internal/evsel.h
index 690943d0408a..c2e0bd104c94 100644
--- a/tools/perf/lib/include/internal/evsel.h
+++ b/tools/perf/lib/include/internal/evsel.h
@@ -2,8 +2,12 @@
2#ifndef __LIBPERF_INTERNAL_EVSEL_H 2#ifndef __LIBPERF_INTERNAL_EVSEL_H
3#define __LIBPERF_INTERNAL_EVSEL_H 3#define __LIBPERF_INTERNAL_EVSEL_H
4 4
5#include <linux/types.h>
6#include <linux/perf_event.h>
7
5struct perf_evsel { 8struct perf_evsel {
6 struct list_head node; 9 struct list_head node;
10 struct perf_event_attr attr;
7}; 11};
8 12
9#endif /* __LIBPERF_INTERNAL_EVSEL_H */ 13#endif /* __LIBPERF_INTERNAL_EVSEL_H */
diff --git a/tools/perf/lib/include/perf/evsel.h b/tools/perf/lib/include/perf/evsel.h
index b4d074a3684b..295583b89f46 100644
--- a/tools/perf/lib/include/perf/evsel.h
+++ b/tools/perf/lib/include/perf/evsel.h
@@ -5,7 +5,9 @@
5#include <perf/core.h> 5#include <perf/core.h>
6 6
7struct perf_evsel; 7struct perf_evsel;
8struct perf_event_attr;
8 9
9LIBPERF_API void perf_evsel__init(struct perf_evsel *evsel); 10LIBPERF_API void perf_evsel__init(struct perf_evsel *evsel,
11 struct perf_event_attr *attr);
10 12
11#endif /* __LIBPERF_EVSEL_H */ 13#endif /* __LIBPERF_EVSEL_H */