0001
0002 #ifndef __LIBPERF_INTERNAL_EVSEL_H
0003 #define __LIBPERF_INTERNAL_EVSEL_H
0004
0005 #include <linux/types.h>
0006 #include <linux/perf_event.h>
0007 #include <stdbool.h>
0008 #include <sys/types.h>
0009 #include <internal/cpumap.h>
0010
0011 struct perf_thread_map;
0012 struct xyarray;
0013
0014
0015
0016
0017
0018 struct perf_sample_id {
0019 struct hlist_node node;
0020 u64 id;
0021 struct perf_evsel *evsel;
0022
0023
0024
0025
0026
0027
0028
0029 int idx;
0030 struct perf_cpu cpu;
0031 pid_t tid;
0032
0033
0034 pid_t machine_pid;
0035 struct perf_cpu vcpu;
0036
0037
0038 u64 period;
0039 };
0040
0041 struct perf_evsel {
0042 struct list_head node;
0043 struct perf_event_attr attr;
0044 struct perf_cpu_map *cpus;
0045 struct perf_cpu_map *own_cpus;
0046 struct perf_thread_map *threads;
0047 struct xyarray *fd;
0048 struct xyarray *mmap;
0049 struct xyarray *sample_id;
0050 u64 *id;
0051 u32 ids;
0052 struct perf_evsel *leader;
0053
0054
0055 int nr_members;
0056
0057
0058
0059
0060
0061
0062 bool system_wide;
0063
0064
0065
0066
0067 bool requires_cpu;
0068 int idx;
0069 };
0070
0071 void perf_evsel__init(struct perf_evsel *evsel, struct perf_event_attr *attr,
0072 int idx);
0073 int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads);
0074 void perf_evsel__close_fd(struct perf_evsel *evsel);
0075 void perf_evsel__free_fd(struct perf_evsel *evsel);
0076 int perf_evsel__read_size(struct perf_evsel *evsel);
0077 int perf_evsel__apply_filter(struct perf_evsel *evsel, const char *filter);
0078
0079 int perf_evsel__alloc_id(struct perf_evsel *evsel, int ncpus, int nthreads);
0080 void perf_evsel__free_id(struct perf_evsel *evsel);
0081
0082 #endif