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>
This commit is contained in:

committed by
Arnaldo Carvalho de Melo

parent
959b83c769
commit
397721e06e
@@ -3,3 +3,16 @@
|
||||
#include <stdlib.h>
|
||||
#include <linux/refcount.h>
|
||||
#include <internal/cpumap.h>
|
||||
|
||||
struct perf_cpu_map *perf_cpu_map__dummy_new(void)
|
||||
{
|
||||
struct perf_cpu_map *cpus = malloc(sizeof(*cpus) + sizeof(int));
|
||||
|
||||
if (cpus != NULL) {
|
||||
cpus->nr = 1;
|
||||
cpus->map[0] = -1;
|
||||
refcount_set(&cpus->refcnt, 1);
|
||||
}
|
||||
|
||||
return cpus;
|
||||
}
|
||||
|
@@ -2,6 +2,10 @@
|
||||
#ifndef __LIBPERF_CPUMAP_H
|
||||
#define __LIBPERF_CPUMAP_H
|
||||
|
||||
#include <perf/core.h>
|
||||
|
||||
struct perf_cpu_map;
|
||||
|
||||
LIBPERF_API struct perf_cpu_map *perf_cpu_map__dummy_new(void);
|
||||
|
||||
#endif /* __LIBPERF_CPUMAP_H */
|
||||
|
@@ -1,6 +1,7 @@
|
||||
LIBPERF_0.0.1 {
|
||||
global:
|
||||
libperf_set_print;
|
||||
perf_cpu_map__dummy_new;
|
||||
local:
|
||||
*;
|
||||
};
|
||||
|
Reference in New Issue
Block a user