diff options
author | Jiri Olsa <jolsa@kernel.org> | 2019-07-21 07:24:15 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-07-29 17:34:44 -0400 |
commit | 959b83c769389b24d64759f60e64c4c62620ff02 (patch) | |
tree | c09e4d141e66c8854585c102b87abae70f0606b4 /tools/perf/lib | |
parent | a1556f8479ed58b8d5a33aef54578bad0165c7e7 (diff) |
libperf: Add perf_cpu_map struct
Add perf_cpu_map struct to libperf.
It's added as a declaration into:
include/perf/cpumap.h
which will be included by users.
The perf_cpu_map struct definition is added into:
include/internal/cpumap.h
which is not to be included by users, but shared within perf and
libperf.
We tried the total separation of the perf_cpu_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 <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-29-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/Build | 1 | ||||
-rw-r--r-- | tools/perf/lib/cpumap.c | 5 | ||||
-rw-r--r-- | tools/perf/lib/include/internal/cpumap.h | 13 | ||||
-rw-r--r-- | tools/perf/lib/include/perf/cpumap.h | 7 |
4 files changed, 26 insertions, 0 deletions
diff --git a/tools/perf/lib/Build b/tools/perf/lib/Build index 5196958cec01..195b274db49a 100644 --- a/tools/perf/lib/Build +++ b/tools/perf/lib/Build | |||
@@ -1 +1,2 @@ | |||
1 | libperf-y += core.o | 1 | libperf-y += core.o |
2 | libperf-y += cpumap.o | ||
diff --git a/tools/perf/lib/cpumap.c b/tools/perf/lib/cpumap.c new file mode 100644 index 000000000000..86a199c26f20 --- /dev/null +++ b/tools/perf/lib/cpumap.c | |||
@@ -0,0 +1,5 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0-only | ||
2 | #include <perf/cpumap.h> | ||
3 | #include <stdlib.h> | ||
4 | #include <linux/refcount.h> | ||
5 | #include <internal/cpumap.h> | ||
diff --git a/tools/perf/lib/include/internal/cpumap.h b/tools/perf/lib/include/internal/cpumap.h new file mode 100644 index 000000000000..53ce95374b05 --- /dev/null +++ b/tools/perf/lib/include/internal/cpumap.h | |||
@@ -0,0 +1,13 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
2 | #ifndef __LIBPERF_INTERNAL_CPUMAP_H | ||
3 | #define __LIBPERF_INTERNAL_CPUMAP_H | ||
4 | |||
5 | #include <linux/refcount.h> | ||
6 | |||
7 | struct perf_cpu_map { | ||
8 | refcount_t refcnt; | ||
9 | int nr; | ||
10 | int map[]; | ||
11 | }; | ||
12 | |||
13 | #endif /* __LIBPERF_INTERNAL_CPUMAP_H */ | ||
diff --git a/tools/perf/lib/include/perf/cpumap.h b/tools/perf/lib/include/perf/cpumap.h new file mode 100644 index 000000000000..8355d3ce7d0c --- /dev/null +++ b/tools/perf/lib/include/perf/cpumap.h | |||
@@ -0,0 +1,7 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
2 | #ifndef __LIBPERF_CPUMAP_H | ||
3 | #define __LIBPERF_CPUMAP_H | ||
4 | |||
5 | struct perf_cpu_map; | ||
6 | |||
7 | #endif /* __LIBPERF_CPUMAP_H */ | ||