• Home
  • Raw
  • Download

Lines Matching refs:evsel

19 void perf_evsel__init(struct perf_evsel *evsel, struct perf_event_attr *attr)  in perf_evsel__init()  argument
21 INIT_LIST_HEAD(&evsel->node); in perf_evsel__init()
22 evsel->attr = *attr; in perf_evsel__init()
27 struct perf_evsel *evsel = zalloc(sizeof(*evsel)); in perf_evsel__new() local
29 if (evsel != NULL) in perf_evsel__new()
30 perf_evsel__init(evsel, attr); in perf_evsel__new()
32 return evsel; in perf_evsel__new()
35 void perf_evsel__delete(struct perf_evsel *evsel) in perf_evsel__delete() argument
37 free(evsel); in perf_evsel__delete()
42 int perf_evsel__alloc_fd(struct perf_evsel *evsel, int ncpus, int nthreads) in perf_evsel__alloc_fd() argument
44 evsel->fd = xyarray__new(ncpus, nthreads, sizeof(int)); in perf_evsel__alloc_fd()
46 if (evsel->fd) { in perf_evsel__alloc_fd()
50 FD(evsel, cpu, thread) = -1; in perf_evsel__alloc_fd()
55 return evsel->fd != NULL ? 0 : -ENOMEM; in perf_evsel__alloc_fd()
66 int perf_evsel__open(struct perf_evsel *evsel, struct perf_cpu_map *cpus, in perf_evsel__open() argument
95 if (evsel->fd == NULL && in perf_evsel__open()
96 perf_evsel__alloc_fd(evsel, cpus->nr, threads->nr) < 0) in perf_evsel__open()
103 fd = sys_perf_event_open(&evsel->attr, in perf_evsel__open()
110 FD(evsel, cpu, thread) = fd; in perf_evsel__open()
117 void perf_evsel__close_fd(struct perf_evsel *evsel) in perf_evsel__close_fd() argument
121 for (cpu = 0; cpu < xyarray__max_x(evsel->fd); cpu++) in perf_evsel__close_fd()
122 for (thread = 0; thread < xyarray__max_y(evsel->fd); ++thread) { in perf_evsel__close_fd()
123 close(FD(evsel, cpu, thread)); in perf_evsel__close_fd()
124 FD(evsel, cpu, thread) = -1; in perf_evsel__close_fd()
128 void perf_evsel__free_fd(struct perf_evsel *evsel) in perf_evsel__free_fd() argument
130 xyarray__delete(evsel->fd); in perf_evsel__free_fd()
131 evsel->fd = NULL; in perf_evsel__free_fd()
134 void perf_evsel__close(struct perf_evsel *evsel) in perf_evsel__close() argument
136 if (evsel->fd == NULL) in perf_evsel__close()
139 perf_evsel__close_fd(evsel); in perf_evsel__close()
140 perf_evsel__free_fd(evsel); in perf_evsel__close()
143 int perf_evsel__read_size(struct perf_evsel *evsel) in perf_evsel__read_size() argument
145 u64 read_format = evsel->attr.read_format; in perf_evsel__read_size()
160 nr = evsel->nr_members; in perf_evsel__read_size()
168 int perf_evsel__read(struct perf_evsel *evsel, int cpu, int thread, in perf_evsel__read() argument
171 size_t size = perf_evsel__read_size(evsel); in perf_evsel__read()
175 if (FD(evsel, cpu, thread) < 0) in perf_evsel__read()
178 if (readn(FD(evsel, cpu, thread), count->values, size) <= 0) in perf_evsel__read()
184 static int perf_evsel__run_ioctl(struct perf_evsel *evsel, in perf_evsel__run_ioctl() argument
189 for (cpu = 0; cpu < xyarray__max_x(evsel->fd); cpu++) { in perf_evsel__run_ioctl()
190 for (thread = 0; thread < xyarray__max_y(evsel->fd); thread++) { in perf_evsel__run_ioctl()
191 int fd = FD(evsel, cpu, thread), in perf_evsel__run_ioctl()
202 int perf_evsel__enable(struct perf_evsel *evsel) in perf_evsel__enable() argument
204 return perf_evsel__run_ioctl(evsel, PERF_EVENT_IOC_ENABLE, 0); in perf_evsel__enable()
207 int perf_evsel__disable(struct perf_evsel *evsel) in perf_evsel__disable() argument
209 return perf_evsel__run_ioctl(evsel, PERF_EVENT_IOC_DISABLE, 0); in perf_evsel__disable()
212 int perf_evsel__apply_filter(struct perf_evsel *evsel, const char *filter) in perf_evsel__apply_filter() argument
214 return perf_evsel__run_ioctl(evsel, in perf_evsel__apply_filter()
219 struct perf_cpu_map *perf_evsel__cpus(struct perf_evsel *evsel) in perf_evsel__cpus() argument
221 return evsel->cpus; in perf_evsel__cpus()
224 struct perf_thread_map *perf_evsel__threads(struct perf_evsel *evsel) in perf_evsel__threads() argument
226 return evsel->threads; in perf_evsel__threads()
229 struct perf_event_attr *perf_evsel__attr(struct perf_evsel *evsel) in perf_evsel__attr() argument
231 return &evsel->attr; in perf_evsel__attr()
234 int perf_evsel__alloc_id(struct perf_evsel *evsel, int ncpus, int nthreads) in perf_evsel__alloc_id() argument
239 if (evsel->system_wide) in perf_evsel__alloc_id()
242 evsel->sample_id = xyarray__new(ncpus, nthreads, sizeof(struct perf_sample_id)); in perf_evsel__alloc_id()
243 if (evsel->sample_id == NULL) in perf_evsel__alloc_id()
246 evsel->id = zalloc(ncpus * nthreads * sizeof(u64)); in perf_evsel__alloc_id()
247 if (evsel->id == NULL) { in perf_evsel__alloc_id()
248 xyarray__delete(evsel->sample_id); in perf_evsel__alloc_id()
249 evsel->sample_id = NULL; in perf_evsel__alloc_id()
256 void perf_evsel__free_id(struct perf_evsel *evsel) in perf_evsel__free_id() argument
258 xyarray__delete(evsel->sample_id); in perf_evsel__free_id()
259 evsel->sample_id = NULL; in perf_evsel__free_id()
260 zfree(&evsel->id); in perf_evsel__free_id()
261 evsel->ids = 0; in perf_evsel__free_id()