From: Jiri Olsa Date: Sun, 21 Jul 2019 11:24:18 +0000 (+0200) Subject: libperf: Add perf_thread_map struct X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=07acd22677ac6bb2db404d1d258e8c7d06ca7706;p=linux.git libperf: Add perf_thread_map struct Add perf_thread_map struct to libperf. It's added as a declaration into into: include/perf/threadmap.h which will be included by users. The perf_thread_map struct definition is added into: include/internal/threadmap.h which is not to be included by users, but shared within perf and libperf. We tried the total separation of the perf_thread_map struct in libperf, but it lead to complications and much bigger changes in perf code, so we decided to share the declaration. Signed-off-by: Jiri Olsa Cc: Alexander Shishkin Cc: Alexey Budankov Cc: Andi Kleen Cc: Michael Petlan Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20190721112506.12306-32-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/lib/Build b/tools/perf/lib/Build index 195b274db49ae..9beadfc81a71c 100644 --- a/tools/perf/lib/Build +++ b/tools/perf/lib/Build @@ -1,2 +1,3 @@ libperf-y += core.o libperf-y += cpumap.o +libperf-y += threadmap.o diff --git a/tools/perf/lib/include/internal/threadmap.h b/tools/perf/lib/include/internal/threadmap.h new file mode 100644 index 0000000000000..c8088005a9ab8 --- /dev/null +++ b/tools/perf/lib/include/internal/threadmap.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LIBPERF_INTERNAL_THREADMAP_H +#define __LIBPERF_INTERNAL_THREADMAP_H + +#include +#include +#include + +struct thread_map_data { + pid_t pid; + char *comm; +}; + +struct perf_thread_map { + refcount_t refcnt; + int nr; + int err_thread; + struct thread_map_data map[]; +}; + +#endif /* __LIBPERF_INTERNAL_THREADMAP_H */ diff --git a/tools/perf/lib/include/perf/threadmap.h b/tools/perf/lib/include/perf/threadmap.h new file mode 100644 index 0000000000000..dc3a3837b56f7 --- /dev/null +++ b/tools/perf/lib/include/perf/threadmap.h @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LIBPERF_THREADMAP_H +#define __LIBPERF_THREADMAP_H + +struct perf_thread_map; + +#endif /* __LIBPERF_THREADMAP_H */ diff --git a/tools/perf/lib/threadmap.c b/tools/perf/lib/threadmap.c new file mode 100644 index 0000000000000..163dc609b9091 --- /dev/null +++ b/tools/perf/lib/threadmap.c @@ -0,0 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0 +#include +#include +#include +#include diff --git a/tools/perf/util/thread_map.h b/tools/perf/util/thread_map.h index 9358b1b6e657e..5a7be6f8934fd 100644 --- a/tools/perf/util/thread_map.h +++ b/tools/perf/util/thread_map.h @@ -5,18 +5,7 @@ #include #include #include - -struct thread_map_data { - pid_t pid; - char *comm; -}; - -struct perf_thread_map { - refcount_t refcnt; - int nr; - int err_thread; - struct thread_map_data map[]; -}; +#include struct thread_map_event;