mirror of
https://github.com/torvalds/linux.git
synced 2026-11-24 15:33:28 +00:00
A common problem is confusing CPU map indices with the CPU, by wrapping the CPU with a struct then this is avoided. This approach is similar to atomic_t. Committer notes: To make it build with BUILD_BPF_SKEL=1 these files needed the conversions to 'struct perf_cpu' usage: tools/perf/util/bpf_counter.c tools/perf/util/bpf_counter_cgroup.c tools/perf/util/bpf_ftrace.c Also perf_env__get_cpu() was removed back in "perf cpumap: Switch cpu_map__build_map to cpu function". Additionally these needed to be fixed for the ARM builds to complete: tools/perf/arch/arm/util/cs-etm.c tools/perf/arch/arm64/util/pmu.c Suggested-by: John Garry <[email protected]> Signed-off-by: Ian Rogers <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: James Clark <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Kan Liang <[email protected]> Cc: Leo Yan <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Mathieu Poirier <[email protected]> Cc: Mike Leach <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Paul Clarke <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Riccardo Mancini <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Suzuki Poulouse <[email protected]> Cc: Vineet Singh <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
68 lines
1.9 KiB
C
68 lines
1.9 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __LIBPERF_INTERNAL_EVSEL_H
|
|
#define __LIBPERF_INTERNAL_EVSEL_H
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/perf_event.h>
|
|
#include <stdbool.h>
|
|
#include <sys/types.h>
|
|
#include <internal/cpumap.h>
|
|
|
|
struct perf_thread_map;
|
|
struct xyarray;
|
|
|
|
/*
|
|
* Per fd, to map back from PERF_SAMPLE_ID to evsel, only used when there are
|
|
* more than one entry in the evlist.
|
|
*/
|
|
struct perf_sample_id {
|
|
struct hlist_node node;
|
|
u64 id;
|
|
struct perf_evsel *evsel;
|
|
/*
|
|
* 'idx' will be used for AUX area sampling. A sample will have AUX area
|
|
* data that will be queued for decoding, where there are separate
|
|
* queues for each CPU (per-cpu tracing) or task (per-thread tracing).
|
|
* The sample ID can be used to lookup 'idx' which is effectively the
|
|
* queue number.
|
|
*/
|
|
int idx;
|
|
struct perf_cpu cpu;
|
|
pid_t tid;
|
|
|
|
/* Holds total ID period value for PERF_SAMPLE_READ processing. */
|
|
u64 period;
|
|
};
|
|
|
|
struct perf_evsel {
|
|
struct list_head node;
|
|
struct perf_event_attr attr;
|
|
struct perf_cpu_map *cpus;
|
|
struct perf_cpu_map *own_cpus;
|
|
struct perf_thread_map *threads;
|
|
struct xyarray *fd;
|
|
struct xyarray *mmap;
|
|
struct xyarray *sample_id;
|
|
u64 *id;
|
|
u32 ids;
|
|
struct perf_evsel *leader;
|
|
|
|
/* parse modifier helper */
|
|
int nr_members;
|
|
bool system_wide;
|
|
int idx;
|
|
};
|
|
|
|
void perf_evsel__init(struct perf_evsel *evsel, struct perf_event_attr *attr,
|
|
int idx);
|
|
int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads);
|
|
void perf_evsel__close_fd(struct perf_evsel *evsel);
|
|
void perf_evsel__free_fd(struct perf_evsel *evsel);
|
|
int perf_evsel__read_size(struct perf_evsel *evsel);
|
|
int perf_evsel__apply_filter(struct perf_evsel *evsel, const char *filter);
|
|
|
|
int perf_evsel__alloc_id(struct perf_evsel *evsel, int ncpus, int nthreads);
|
|
void perf_evsel__free_id(struct perf_evsel *evsel);
|
|
|
|
#endif /* __LIBPERF_INTERNAL_EVSEL_H */
|