File libperf-add-perf_thread_map-struct.patch of Package perf
129
1
From: Jiri Olsa <jolsa@kernel.org>
2
Date: Sun, 21 Jul 2019 13:24:18 +0200
3
Subject: libperf: Add perf_thread_map struct
4
Git-commit: 07acd22677ac6bb2db404d1d258e8c7d06ca7706
5
Patch-mainline: v5.4-rc1
6
References: jsc#SLE-13661
7
8
Add perf_thread_map struct to libperf.
9
10
It's added as a declaration into into:
11
12
include/perf/threadmap.h
13
14
which will be included by users.
15
16
The perf_thread_map struct definition is added into:
17
18
include/internal/threadmap.h
19
20
which is not to be included by users, but shared within perf and
21
libperf.
22
23
We tried the total separation of the perf_thread_map struct in libperf,
24
but it lead to complications and much bigger changes in perf code, so we
25
decided to share the declaration.
26
27
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
28
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
29
Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
30
Cc: Andi Kleen <ak@linux.intel.com>
31
Cc: Michael Petlan <mpetlan@redhat.com>
32
Cc: Namhyung Kim <namhyung@kernel.org>
33
Cc: Peter Zijlstra <peterz@infradead.org>
34
Link: http://lkml.kernel.org/r/20190721112506.12306-32-jolsa@kernel.org
35
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
36
Signed-off-by: Tony Jones <tonyj@suse.de>
37
---
38
tools/perf/lib/Build | 1 +
39
tools/perf/lib/include/internal/threadmap.h | 21 +++++++++++++++++++++
40
tools/perf/lib/include/perf/threadmap.h | 7 +++++++
41
tools/perf/lib/threadmap.c | 5 +++++
42
tools/perf/util/thread_map.h | 13 +------------
43
5 files changed, 35 insertions(+), 12 deletions(-)
44
45
diff --git a/tools/perf/lib/Build b/tools/perf/lib/Build
46
index 195b274db49a..9beadfc81a71 100644
47
--- a/tools/perf/lib/Build
48
+++ b/tools/perf/lib/Build
49
50
libperf-y += core.o
51
libperf-y += cpumap.o
52
+libperf-y += threadmap.o
53
diff --git a/tools/perf/lib/include/internal/threadmap.h b/tools/perf/lib/include/internal/threadmap.h
54
new file mode 100644
55
index 000000000000..c8088005a9ab
56
--- /dev/null
57
+++ b/tools/perf/lib/include/internal/threadmap.h
58
59
+/* SPDX-License-Identifier: GPL-2.0 */
60
+#ifndef __LIBPERF_INTERNAL_THREADMAP_H
61
+#define __LIBPERF_INTERNAL_THREADMAP_H
62
+
63
+#include <linux/refcount.h>
64
+#include <sys/types.h>
65
+#include <unistd.h>
66
+
67
+struct thread_map_data {
68
+ pid_t pid;
69
+ char *comm;
70
+};
71
+
72
+struct perf_thread_map {
73
+ refcount_t refcnt;
74
+ int nr;
75
+ int err_thread;
76
+ struct thread_map_data map[];
77
+};
78
+
79
+#endif /* __LIBPERF_INTERNAL_THREADMAP_H */
80
diff --git a/tools/perf/lib/include/perf/threadmap.h b/tools/perf/lib/include/perf/threadmap.h
81
new file mode 100644
82
index 000000000000..dc3a3837b56f
83
--- /dev/null
84
+++ b/tools/perf/lib/include/perf/threadmap.h
85
86
+/* SPDX-License-Identifier: GPL-2.0 */
87
+#ifndef __LIBPERF_THREADMAP_H
88
+#define __LIBPERF_THREADMAP_H
89
+
90
+struct perf_thread_map;
91
+
92
+#endif /* __LIBPERF_THREADMAP_H */
93
diff --git a/tools/perf/lib/threadmap.c b/tools/perf/lib/threadmap.c
94
new file mode 100644
95
index 000000000000..163dc609b909
96
--- /dev/null
97
+++ b/tools/perf/lib/threadmap.c
98
99
+// SPDX-License-Identifier: GPL-2.0
100
+#include <perf/threadmap.h>
101
+#include <stdlib.h>
102
+#include <linux/refcount.h>
103
+#include <internal/threadmap.h>
104
diff --git a/tools/perf/util/thread_map.h b/tools/perf/util/thread_map.h
105
index 9358b1b6e657..5a7be6f8934f 100644
106
--- a/tools/perf/util/thread_map.h
107
+++ b/tools/perf/util/thread_map.h
108
109
#include <sys/types.h>
110
#include <stdio.h>
111
#include <linux/refcount.h>
112
-
113
-struct thread_map_data {
114
- pid_t pid;
115
- char *comm;
116
-};
117
-
118
-struct perf_thread_map {
119
- refcount_t refcnt;
120
- int nr;
121
- int err_thread;
122
- struct thread_map_data map[];
123
-};
124
+#include <internal/threadmap.h>
125
126
struct thread_map_event;
127
128
129