Lines Matching refs:fd

46 #define FD(e, x, y) ((int *) xyarray__entry(e->fd, x, y))
51 evsel->fd = xyarray__new(ncpus, nthreads, sizeof(int)); in perf_evsel__alloc_fd()
53 if (evsel->fd) { in perf_evsel__alloc_fd()
57 int *fd = FD(evsel, cpu, thread); in perf_evsel__alloc_fd() local
59 if (fd) in perf_evsel__alloc_fd()
60 *fd = -1; in perf_evsel__alloc_fd()
65 return evsel->fd != NULL ? 0 : -ENOMEM; in perf_evsel__alloc_fd()
86 int *fd; in get_group_fd() local
97 if (!leader->fd) in get_group_fd()
100 fd = FD(leader, cpu, thread); in get_group_fd()
101 if (fd == NULL || *fd == -1) in get_group_fd()
104 *group_fd = *fd; in get_group_fd()
138 if (evsel->fd == NULL && in perf_evsel__open()
144 int fd, group_fd, *evsel_fd; in perf_evsel__open() local
154 fd = sys_perf_event_open(&evsel->attr, in perf_evsel__open()
158 if (fd < 0) in perf_evsel__open()
161 *evsel_fd = fd; in perf_evsel__open()
172 for (thread = 0; thread < xyarray__max_y(evsel->fd); ++thread) { in perf_evsel__close_fd_cpu()
173 int *fd = FD(evsel, cpu, thread); in perf_evsel__close_fd_cpu() local
175 if (fd && *fd >= 0) { in perf_evsel__close_fd_cpu()
176 close(*fd); in perf_evsel__close_fd_cpu()
177 *fd = -1; in perf_evsel__close_fd_cpu()
186 for (cpu = 0; cpu < xyarray__max_x(evsel->fd); cpu++) in perf_evsel__close_fd()
192 xyarray__delete(evsel->fd); in perf_evsel__free_fd()
193 evsel->fd = NULL; in perf_evsel__free_fd()
198 if (evsel->fd == NULL) in perf_evsel__close()
207 if (evsel->fd == NULL) in perf_evsel__close_cpu()
217 if (evsel->fd == NULL || evsel->mmap == NULL) in perf_evsel__munmap()
220 for (cpu = 0; cpu < xyarray__max_x(evsel->fd); cpu++) { in perf_evsel__munmap()
221 for (thread = 0; thread < xyarray__max_y(evsel->fd); thread++) { in perf_evsel__munmap()
222 int *fd = FD(evsel, cpu, thread); in perf_evsel__munmap() local
224 if (fd == NULL || *fd < 0) in perf_evsel__munmap()
243 if (evsel->fd == NULL || evsel->mmap) in perf_evsel__mmap()
246 if (perf_evsel__alloc_mmap(evsel, xyarray__max_x(evsel->fd), xyarray__max_y(evsel->fd)) < 0) in perf_evsel__mmap()
249 for (cpu = 0; cpu < xyarray__max_x(evsel->fd); cpu++) { in perf_evsel__mmap()
250 for (thread = 0; thread < xyarray__max_y(evsel->fd); thread++) { in perf_evsel__mmap()
251 int *fd = FD(evsel, cpu, thread); in perf_evsel__mmap() local
254 if (fd == NULL || *fd < 0) in perf_evsel__mmap()
260 ret = perf_mmap__mmap(map, &mp, *fd, cpu); in perf_evsel__mmap()
273 int *fd = FD(evsel, cpu, thread); in perf_evsel__mmap_base() local
275 if (fd == NULL || *fd < 0 || MMAP(evsel, cpu, thread) == NULL) in perf_evsel__mmap_base()
310 int *fd = FD(evsel, cpu, thread); in perf_evsel__read() local
314 if (fd == NULL || *fd < 0) in perf_evsel__read()
321 if (readn(*fd, count->values, size) <= 0) in perf_evsel__read()
333 for (thread = 0; thread < xyarray__max_y(evsel->fd); thread++) { in perf_evsel__run_ioctl()
335 int *fd = FD(evsel, cpu, thread); in perf_evsel__run_ioctl() local
337 if (fd == NULL || *fd < 0) in perf_evsel__run_ioctl()
340 err = ioctl(*fd, ioc, arg); in perf_evsel__run_ioctl()
359 for (i = 0; i < xyarray__max_x(evsel->fd) && !err; i++) in perf_evsel__enable()
374 for (i = 0; i < xyarray__max_x(evsel->fd) && !err; i++) in perf_evsel__disable()