Lines Matching full:fd

46 #define FD(_evsel, _cpu_map_idx, _thread)				\  macro
47 ((int *)xyarray__entry(_evsel->fd, _cpu_map_idx, _thread))
54 evsel->fd = xyarray__new(ncpus, nthreads, sizeof(int)); in perf_evsel__alloc_fd()
56 if (evsel->fd) { in perf_evsel__alloc_fd()
61 int *fd = FD(evsel, idx, thread); in perf_evsel__alloc_fd() local
63 if (fd) in perf_evsel__alloc_fd()
64 *fd = -1; in perf_evsel__alloc_fd()
69 return evsel->fd != NULL ? 0 : -ENOMEM; in perf_evsel__alloc_fd()
90 int *fd; in get_group_fd() local
101 if (!leader->fd) in get_group_fd()
104 fd = FD(leader, cpu_map_idx, thread); in get_group_fd()
105 if (fd == NULL || *fd == -1) in get_group_fd()
108 *group_fd = *fd; in get_group_fd()
143 if (evsel->fd == NULL && in perf_evsel__open()
149 int fd, group_fd, *evsel_fd; in perf_evsel__open() local
151 evsel_fd = FD(evsel, idx, thread); in perf_evsel__open()
161 fd = sys_perf_event_open(&evsel->attr, in perf_evsel__open()
165 if (fd < 0) { in perf_evsel__open()
170 *evsel_fd = fd; in perf_evsel__open()
184 for (thread = 0; thread < xyarray__max_y(evsel->fd); ++thread) { in perf_evsel__close_fd_cpu()
185 int *fd = FD(evsel, cpu_map_idx, thread); in perf_evsel__close_fd_cpu() local
187 if (fd && *fd >= 0) { in perf_evsel__close_fd_cpu()
188 close(*fd); in perf_evsel__close_fd_cpu()
189 *fd = -1; in perf_evsel__close_fd_cpu()
196 for (int idx = 0; idx < xyarray__max_x(evsel->fd); idx++) in perf_evsel__close_fd()
202 xyarray__delete(evsel->fd); in perf_evsel__free_fd()
203 evsel->fd = NULL; in perf_evsel__free_fd()
208 if (evsel->fd == NULL) in perf_evsel__close()
217 if (evsel->fd == NULL) in perf_evsel__close_cpu()
227 if (evsel->fd == NULL || evsel->mmap == NULL) in perf_evsel__munmap()
230 for (idx = 0; idx < xyarray__max_x(evsel->fd); idx++) { in perf_evsel__munmap()
231 for (thread = 0; thread < xyarray__max_y(evsel->fd); thread++) { in perf_evsel__munmap()
232 int *fd = FD(evsel, idx, thread); in perf_evsel__munmap() local
234 if (fd == NULL || *fd < 0) in perf_evsel__munmap()
253 if (evsel->fd == NULL || evsel->mmap) in perf_evsel__mmap()
256 if (perf_evsel__alloc_mmap(evsel, xyarray__max_x(evsel->fd), xyarray__max_y(evsel->fd)) < 0) in perf_evsel__mmap()
259 for (idx = 0; idx < xyarray__max_x(evsel->fd); idx++) { in perf_evsel__mmap()
260 for (thread = 0; thread < xyarray__max_y(evsel->fd); thread++) { in perf_evsel__mmap()
261 int *fd = FD(evsel, idx, thread); in perf_evsel__mmap() local
265 if (fd == NULL || *fd < 0) in perf_evsel__mmap()
271 ret = perf_mmap__mmap(map, &mp, *fd, cpu); in perf_evsel__mmap()
284 int *fd = FD(evsel, cpu_map_idx, thread); in perf_evsel__mmap_base() local
286 if (fd == NULL || *fd < 0 || MMAP(evsel, cpu_map_idx, thread) == NULL) in perf_evsel__mmap_base()
325 int *fd = FD(evsel, cpu_map_idx, thread); in perf_evsel__read_group() local
330 if (fd == NULL || *fd < 0) in perf_evsel__read_group()
337 if (readn(*fd, data, size) <= 0) { in perf_evsel__read_group()
391 int *fd = FD(evsel, cpu_map_idx, thread); in perf_evsel__read() local
397 if (fd == NULL || *fd < 0) in perf_evsel__read()
408 if (readn(*fd, buf.values, size) <= 0) in perf_evsel__read()
418 int *fd = FD(evsel, cpu_map_idx, thread); in perf_evsel__ioctl() local
420 if (fd == NULL || *fd < 0) in perf_evsel__ioctl()
423 return ioctl(*fd, ioc, arg); in perf_evsel__ioctl()
432 for (thread = 0; thread < xyarray__max_y(evsel->fd); thread++) { in perf_evsel__run_ioctl()
467 for (i = 0; i < xyarray__max_x(evsel->fd) && !err; i++) in perf_evsel__enable()
482 for (i = 0; i < xyarray__max_x(evsel->fd) && !err; i++) in perf_evsel__disable()