Lines Matching refs:cpu_buf
13108 struct perf_cpu_buf *cpu_buf) in perf_buffer__free_cpu_buf() argument
13110 if (!cpu_buf) in perf_buffer__free_cpu_buf()
13112 if (cpu_buf->base && in perf_buffer__free_cpu_buf()
13113 munmap(cpu_buf->base, pb->mmap_size + pb->page_size)) in perf_buffer__free_cpu_buf()
13114 pr_warn("failed to munmap cpu_buf #%d\n", cpu_buf->cpu); in perf_buffer__free_cpu_buf()
13115 if (cpu_buf->fd >= 0) { in perf_buffer__free_cpu_buf()
13116 ioctl(cpu_buf->fd, PERF_EVENT_IOC_DISABLE, 0); in perf_buffer__free_cpu_buf()
13117 close(cpu_buf->fd); in perf_buffer__free_cpu_buf()
13119 free(cpu_buf->buf); in perf_buffer__free_cpu_buf()
13120 free(cpu_buf); in perf_buffer__free_cpu_buf()
13131 struct perf_cpu_buf *cpu_buf = pb->cpu_bufs[i]; in perf_buffer__free() local
13133 if (!cpu_buf) in perf_buffer__free()
13136 bpf_map_delete_elem(pb->map_fd, &cpu_buf->map_key); in perf_buffer__free()
13137 perf_buffer__free_cpu_buf(pb, cpu_buf); in perf_buffer__free()
13151 struct perf_cpu_buf *cpu_buf; in perf_buffer__open_cpu_buf() local
13155 cpu_buf = calloc(1, sizeof(*cpu_buf)); in perf_buffer__open_cpu_buf()
13156 if (!cpu_buf) in perf_buffer__open_cpu_buf()
13159 cpu_buf->pb = pb; in perf_buffer__open_cpu_buf()
13160 cpu_buf->cpu = cpu; in perf_buffer__open_cpu_buf()
13161 cpu_buf->map_key = map_key; in perf_buffer__open_cpu_buf()
13163 cpu_buf->fd = syscall(__NR_perf_event_open, attr, -1 /* pid */, cpu, in perf_buffer__open_cpu_buf()
13165 if (cpu_buf->fd < 0) { in perf_buffer__open_cpu_buf()
13172 cpu_buf->base = mmap(NULL, pb->mmap_size + pb->page_size, in perf_buffer__open_cpu_buf()
13174 cpu_buf->fd, 0); in perf_buffer__open_cpu_buf()
13175 if (cpu_buf->base == MAP_FAILED) { in perf_buffer__open_cpu_buf()
13176 cpu_buf->base = NULL; in perf_buffer__open_cpu_buf()
13183 if (ioctl(cpu_buf->fd, PERF_EVENT_IOC_ENABLE, 0) < 0) { in perf_buffer__open_cpu_buf()
13190 return cpu_buf; in perf_buffer__open_cpu_buf()
13193 perf_buffer__free_cpu_buf(pb, cpu_buf); in perf_buffer__open_cpu_buf()
13351 struct perf_cpu_buf *cpu_buf; in __perf_buffer__new() local
13363 cpu_buf = perf_buffer__open_cpu_buf(pb, p->attr, cpu, map_key); in __perf_buffer__new()
13364 if (IS_ERR(cpu_buf)) { in __perf_buffer__new()
13365 err = PTR_ERR(cpu_buf); in __perf_buffer__new()
13369 pb->cpu_bufs[j] = cpu_buf; in __perf_buffer__new()
13372 &cpu_buf->fd, 0); in __perf_buffer__new()
13376 cpu, map_key, cpu_buf->fd, in __perf_buffer__new()
13382 pb->events[j].data.ptr = cpu_buf; in __perf_buffer__new()
13383 if (epoll_ctl(pb->epoll_fd, EPOLL_CTL_ADD, cpu_buf->fd, in __perf_buffer__new()
13387 cpu, cpu_buf->fd, in __perf_buffer__new()
13421 struct perf_cpu_buf *cpu_buf = ctx; in perf_buffer__process_record() local
13422 struct perf_buffer *pb = cpu_buf->pb; in perf_buffer__process_record()
13427 return pb->event_cb(pb->ctx, cpu_buf->cpu, e); in perf_buffer__process_record()
13434 pb->sample_cb(pb->ctx, cpu_buf->cpu, s->data, s->size); in perf_buffer__process_record()
13441 pb->lost_cb(pb->ctx, cpu_buf->cpu, s->lost); in perf_buffer__process_record()
13452 struct perf_cpu_buf *cpu_buf) in perf_buffer__process_records() argument
13456 ret = perf_event_read_simple(cpu_buf->base, pb->mmap_size, in perf_buffer__process_records()
13457 pb->page_size, &cpu_buf->buf, in perf_buffer__process_records()
13458 &cpu_buf->buf_size, in perf_buffer__process_records()
13459 perf_buffer__process_record, cpu_buf); in perf_buffer__process_records()
13479 struct perf_cpu_buf *cpu_buf = pb->events[i].data.ptr; in perf_buffer__poll() local
13481 err = perf_buffer__process_records(pb, cpu_buf); in perf_buffer__poll()
13505 struct perf_cpu_buf *cpu_buf; in perf_buffer__buffer_fd() local
13510 cpu_buf = pb->cpu_bufs[buf_idx]; in perf_buffer__buffer_fd()
13511 if (!cpu_buf) in perf_buffer__buffer_fd()
13514 return cpu_buf->fd; in perf_buffer__buffer_fd()
13519 struct perf_cpu_buf *cpu_buf; in perf_buffer__buffer() local
13524 cpu_buf = pb->cpu_bufs[buf_idx]; in perf_buffer__buffer()
13525 if (!cpu_buf) in perf_buffer__buffer()
13528 *buf = cpu_buf->base; in perf_buffer__buffer()
13543 struct perf_cpu_buf *cpu_buf; in perf_buffer__consume_buffer() local
13548 cpu_buf = pb->cpu_bufs[buf_idx]; in perf_buffer__consume_buffer()
13549 if (!cpu_buf) in perf_buffer__consume_buffer()
13552 return perf_buffer__process_records(pb, cpu_buf); in perf_buffer__consume_buffer()
13560 struct perf_cpu_buf *cpu_buf = pb->cpu_bufs[i]; in perf_buffer__consume() local
13562 if (!cpu_buf) in perf_buffer__consume()
13565 err = perf_buffer__process_records(pb, cpu_buf); in perf_buffer__consume()