diff options
author | Jiri Olsa <jolsa@kernel.org> | 2019-07-21 07:24:16 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-07-29 17:34:44 -0400 |
commit | 397721e06e52d017cfdd403f63284ed0995d4caf (patch) | |
tree | 723707e12ee50f3e27dc20aa4e2bbf832d15d207 /tools/perf/lib | |
parent | 959b83c769389b24d64759f60e64c4c62620ff02 (diff) |
libperf: Add perf_cpu_map__dummy_new() function
Move cpu_map__dummy_new() to libperf as perf_cpu_map__dummy_new() function.
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-30-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/cpumap.c | 13 | ||||
-rw-r--r-- | tools/perf/lib/include/perf/cpumap.h | 4 | ||||
-rw-r--r-- | tools/perf/lib/libperf.map | 1 |
3 files changed, 18 insertions, 0 deletions
diff --git a/tools/perf/lib/cpumap.c b/tools/perf/lib/cpumap.c index 86a199c26f20..80d587ab95aa 100644 --- a/tools/perf/lib/cpumap.c +++ b/tools/perf/lib/cpumap.c | |||
@@ -3,3 +3,16 @@ | |||
3 | #include <stdlib.h> | 3 | #include <stdlib.h> |
4 | #include <linux/refcount.h> | 4 | #include <linux/refcount.h> |
5 | #include <internal/cpumap.h> | 5 | #include <internal/cpumap.h> |
6 | |||
7 | struct perf_cpu_map *perf_cpu_map__dummy_new(void) | ||
8 | { | ||
9 | struct perf_cpu_map *cpus = malloc(sizeof(*cpus) + sizeof(int)); | ||
10 | |||
11 | if (cpus != NULL) { | ||
12 | cpus->nr = 1; | ||
13 | cpus->map[0] = -1; | ||
14 | refcount_set(&cpus->refcnt, 1); | ||
15 | } | ||
16 | |||
17 | return cpus; | ||
18 | } | ||
diff --git a/tools/perf/lib/include/perf/cpumap.h b/tools/perf/lib/include/perf/cpumap.h index 8355d3ce7d0c..fa1e5aa9d662 100644 --- a/tools/perf/lib/include/perf/cpumap.h +++ b/tools/perf/lib/include/perf/cpumap.h | |||
@@ -2,6 +2,10 @@ | |||
2 | #ifndef __LIBPERF_CPUMAP_H | 2 | #ifndef __LIBPERF_CPUMAP_H |
3 | #define __LIBPERF_CPUMAP_H | 3 | #define __LIBPERF_CPUMAP_H |
4 | 4 | ||
5 | #include <perf/core.h> | ||
6 | |||
5 | struct perf_cpu_map; | 7 | struct perf_cpu_map; |
6 | 8 | ||
9 | LIBPERF_API struct perf_cpu_map *perf_cpu_map__dummy_new(void); | ||
10 | |||
7 | #endif /* __LIBPERF_CPUMAP_H */ | 11 | #endif /* __LIBPERF_CPUMAP_H */ |
diff --git a/tools/perf/lib/libperf.map b/tools/perf/lib/libperf.map index 3536242c545c..65201c6cbe7e 100644 --- a/tools/perf/lib/libperf.map +++ b/tools/perf/lib/libperf.map | |||
@@ -1,6 +1,7 @@ | |||
1 | LIBPERF_0.0.1 { | 1 | LIBPERF_0.0.1 { |
2 | global: | 2 | global: |
3 | libperf_set_print; | 3 | libperf_set_print; |
4 | perf_cpu_map__dummy_new; | ||
4 | local: | 5 | local: |
5 | *; | 6 | *; |
6 | }; | 7 | }; |