mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-09 23:39:18 +00:00
libperf: Add a perf_cpu_map__set_nr() available as an internal function for tools/perf to use
We'll need to reference count check 'struct perf_cpu_map', so wrap accesses to its internal state to allow intercepting accesses to its instances. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com> Cc: Dmitriy Vyukov <dvyukov@google.com> Cc: Ian Rogers <irogers@google.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Riccardo Mancini <rickyman7@gmail.com> Cc: Stephane Eranian <eranian@google.com> Cc: Stephen Brennan <stephen.s.brennan@oracle.com> Link: https://lore.kernel.org/ Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
1f94479edb
commit
b277851417
@ -10,6 +10,11 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
|
void perf_cpu_map__set_nr(struct perf_cpu_map *map, int nr_cpus)
|
||||||
|
{
|
||||||
|
map->nr = nr_cpus;
|
||||||
|
}
|
||||||
|
|
||||||
struct perf_cpu_map *perf_cpu_map__alloc(int nr_cpus)
|
struct perf_cpu_map *perf_cpu_map__alloc(int nr_cpus)
|
||||||
{
|
{
|
||||||
struct perf_cpu_map *cpus = malloc(sizeof(*cpus) + sizeof(struct perf_cpu) * nr_cpus);
|
struct perf_cpu_map *cpus = malloc(sizeof(*cpus) + sizeof(struct perf_cpu) * nr_cpus);
|
||||||
|
@ -28,4 +28,6 @@ struct perf_cpu_map *perf_cpu_map__alloc(int nr_cpus);
|
|||||||
int perf_cpu_map__idx(const struct perf_cpu_map *cpus, struct perf_cpu cpu);
|
int perf_cpu_map__idx(const struct perf_cpu_map *cpus, struct perf_cpu cpu);
|
||||||
bool perf_cpu_map__is_subset(const struct perf_cpu_map *a, const struct perf_cpu_map *b);
|
bool perf_cpu_map__is_subset(const struct perf_cpu_map *a, const struct perf_cpu_map *b);
|
||||||
|
|
||||||
|
void perf_cpu_map__set_nr(struct perf_cpu_map *map, int nr_cpus);
|
||||||
|
|
||||||
#endif /* __LIBPERF_INTERNAL_CPUMAP_H */
|
#endif /* __LIBPERF_INTERNAL_CPUMAP_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user