File libperf-add-perf_evlist__add-function.patch of Package perf
xxxxxxxxxx
1
From: Jiri Olsa <jolsa@kernel.org>
2
Date: Sun, 21 Jul 2019 13:24:26 +0200
3
Subject: libperf: Add perf_evlist__add() function
4
Git-commit: 9a5edde6d3a6fb26101406534f7a5d09a9fcd362
5
Patch-mainline: v5.4-rc1
6
References: jsc#SLE-13661
7
8
Add the perf_evlist__add() function to add a perf_evsel in a perf_evlist
9
struct.
10
11
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
12
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
13
Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
14
Cc: Andi Kleen <ak@linux.intel.com>
15
Cc: Michael Petlan <mpetlan@redhat.com>
16
Cc: Namhyung Kim <namhyung@kernel.org>
17
Cc: Peter Zijlstra <peterz@infradead.org>
18
Link: http://lkml.kernel.org/r/20190721112506.12306-40-jolsa@kernel.org
19
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
20
Signed-off-by: Tony Jones <tonyj@suse.de>
21
---
22
tools/perf/lib/evlist.c | 7 +++++++
23
tools/perf/lib/include/perf/evlist.h | 3 +++
24
tools/perf/lib/libperf.map | 1 +
25
tools/perf/util/evlist.c | 2 +-
26
4 files changed, 12 insertions(+), 1 deletion(-)
27
28
diff --git a/tools/perf/lib/evlist.c b/tools/perf/lib/evlist.c
29
index fdc8c1894b37..e5f187fa4e57 100644
30
--- a/tools/perf/lib/evlist.c
31
+++ b/tools/perf/lib/evlist.c
32
33
#include <perf/evlist.h>
34
#include <linux/list.h>
35
#include <internal/evlist.h>
36
+#include <internal/evsel.h>
37
38
void perf_evlist__init(struct perf_evlist *evlist)
39
{
40
INIT_LIST_HEAD(&evlist->entries);
41
}
42
+
43
+void perf_evlist__add(struct perf_evlist *evlist,
44
+ struct perf_evsel *evsel)
45
+{
46
+ list_add_tail(&evsel->node, &evlist->entries);
47
+}
48
diff --git a/tools/perf/lib/include/perf/evlist.h b/tools/perf/lib/include/perf/evlist.h
49
index 1ddfcca0bd01..6992568b14a0 100644
50
--- a/tools/perf/lib/include/perf/evlist.h
51
+++ b/tools/perf/lib/include/perf/evlist.h
52
53
#include <perf/core.h>
54
55
struct perf_evlist;
56
+struct perf_evsel;
57
58
LIBPERF_API void perf_evlist__init(struct perf_evlist *evlist);
59
+LIBPERF_API void perf_evlist__add(struct perf_evlist *evlist,
60
+ struct perf_evsel *evsel);
61
62
#endif /* __LIBPERF_EVLIST_H */
63
diff --git a/tools/perf/lib/libperf.map b/tools/perf/lib/libperf.map
64
index 5ca6ff6fcdfa..06ccf31eb24d 100644
65
--- a/tools/perf/lib/libperf.map
66
+++ b/tools/perf/lib/libperf.map
67
68
perf_thread_map__put;
69
perf_evsel__init;
70
perf_evlist__init;
71
+ perf_evlist__add;
72
local:
73
*;
74
};
75
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
76
index f4aa6cf80559..f2b86f49ab8d 100644
77
--- a/tools/perf/util/evlist.c
78
+++ b/tools/perf/util/evlist.c
79
80
81
void evlist__add(struct evlist *evlist, struct evsel *entry)
82
{
83
+ perf_evlist__add(&evlist->core, &entry->core);
84
entry->evlist = evlist;
85
- list_add_tail(&entry->core.node, &evlist->core.entries);
86
entry->idx = evlist->nr_entries;
87
entry->tracking = !entry->idx;
88
89
90