/Linux-v5.4/samples/bpf/ |
D | sampleip_user.c | 37 static int sampling_start(int *pmu_fd, int freq) in sampling_start() argument 50 pmu_fd[i] = sys_perf_event_open(&pe_sample_attr, -1 /* pid */, i, in sampling_start() 52 if (pmu_fd[i] < 0) { in sampling_start() 56 assert(ioctl(pmu_fd[i], PERF_EVENT_IOC_SET_BPF, in sampling_start() 58 assert(ioctl(pmu_fd[i], PERF_EVENT_IOC_ENABLE, 0) == 0); in sampling_start() 64 static void sampling_end(int *pmu_fd) in sampling_end() argument 69 close(pmu_fd[i]); in sampling_end() 138 int *pmu_fd, opt, freq = DEFAULT_FREQ, secs = DEFAULT_SECS; in main() local 167 pmu_fd = malloc(nr_cpus * sizeof(int)); in main() 168 if (pmu_fd == NULL) { in main() [all …]
|
D | trace_event_user.c | 140 int *pmu_fd = malloc(nr_cpus * sizeof(int)); in test_perf_event_all_cpu() local 148 pmu_fd[i] = sys_perf_event_open(attr, -1, i, -1, 0); in test_perf_event_all_cpu() 149 if (pmu_fd[i] < 0) { in test_perf_event_all_cpu() 154 assert(ioctl(pmu_fd[i], PERF_EVENT_IOC_SET_BPF, prog_fd[0]) == 0); in test_perf_event_all_cpu() 155 assert(ioctl(pmu_fd[i], PERF_EVENT_IOC_ENABLE) == 0); in test_perf_event_all_cpu() 165 ioctl(pmu_fd[i], PERF_EVENT_IOC_DISABLE); in test_perf_event_all_cpu() 166 close(pmu_fd[i]); in test_perf_event_all_cpu() 168 free(pmu_fd); in test_perf_event_all_cpu() 175 int pmu_fd, error = 0; in test_perf_event_task() local 183 pmu_fd = sys_perf_event_open(attr, 0, -1, -1, 0); in test_perf_event_task() [all …]
|
D | tracex6_user.c | 27 int pmu_fd, error = 0; in check_on_cpu() local 36 pmu_fd = sys_perf_event_open(attr, -1/*pid*/, cpu/*cpu*/, -1/*group_fd*/, 0); in check_on_cpu() 37 if (pmu_fd < 0) { in check_on_cpu() 42 assert(bpf_map_update_elem(map_fd[0], &cpu, &pmu_fd, BPF_ANY) == 0); in check_on_cpu() 43 assert(ioctl(pmu_fd, PERF_EVENT_IOC_ENABLE, 0) == 0); in check_on_cpu() 66 assert(ioctl(pmu_fd, PERF_EVENT_IOC_DISABLE, 0) == 0 || error); in check_on_cpu() 67 assert(close(pmu_fd) == 0 || error); in check_on_cpu()
|
/Linux-v5.4/tools/testing/selftests/bpf/prog_tests/ |
D | tp_attach_query.c | 7 int i, j, bytes, efd, err, prog_fd[num_progs], pmu_fd[num_progs]; in test_tp_attach_query() local 54 pmu_fd[i] = syscall(__NR_perf_event_open, &attr, -1 /* pid */, in test_tp_attach_query() 57 if (CHECK(pmu_fd[i] < 0, "perf_event_open", "err %d errno %d\n", in test_tp_attach_query() 58 pmu_fd[i], errno)) in test_tp_attach_query() 60 err = ioctl(pmu_fd[i], PERF_EVENT_IOC_ENABLE, 0); in test_tp_attach_query() 68 err = ioctl(pmu_fd[i], PERF_EVENT_IOC_QUERY_BPF, query); in test_tp_attach_query() 76 err = ioctl(pmu_fd[i], PERF_EVENT_IOC_SET_BPF, prog_fd[i]); in test_tp_attach_query() 84 err = ioctl(pmu_fd[i], PERF_EVENT_IOC_QUERY_BPF, query); in test_tp_attach_query() 93 err = ioctl(pmu_fd[i], PERF_EVENT_IOC_QUERY_BPF, in test_tp_attach_query() 102 err = ioctl(pmu_fd[i], PERF_EVENT_IOC_QUERY_BPF, query); in test_tp_attach_query() [all …]
|
D | send_signal.c | 15 int err = -1, pmu_fd, prog_fd, info_map_fd, status_map_fd; in test_send_signal_common() local 81 pmu_fd = syscall(__NR_perf_event_open, attr, pid, -1, in test_send_signal_common() 83 if (CHECK(pmu_fd < 0, test_name, "perf_event_open error: %s\n", in test_send_signal_common() 89 err = ioctl(pmu_fd, PERF_EVENT_IOC_ENABLE, 0); in test_send_signal_common() 94 err = ioctl(pmu_fd, PERF_EVENT_IOC_SET_BPF, prog_fd); in test_send_signal_common() 134 close(pmu_fd); in test_send_signal_common() 194 int pmu_fd; in test_send_signal_nmi() local 199 pmu_fd = syscall(__NR_perf_event_open, &attr, 0 /* pid */, in test_send_signal_nmi() 201 if (pmu_fd == -1) { in test_send_signal_nmi() 210 close(pmu_fd); in test_send_signal_nmi()
|
D | task_fd_query_tp.c | 8 int err, bytes, efd, prog_fd, pmu_fd; in test_task_fd_query_tp_core() local 36 pmu_fd = syscall(__NR_perf_event_open, &attr, -1 /* pid */, in test_task_fd_query_tp_core() 42 err = ioctl(pmu_fd, PERF_EVENT_IOC_ENABLE, 0); in test_task_fd_query_tp_core() 47 err = ioctl(pmu_fd, PERF_EVENT_IOC_SET_BPF, prog_fd); in test_task_fd_query_tp_core() 54 err = bpf_task_fd_query(getpid(), pmu_fd, 0, buf, &len, &prog_id, in test_task_fd_query_tp_core() 66 close(pmu_fd); in test_task_fd_query_tp_core()
|
D | stacktrace_build_id_nmi.c | 22 int err, pmu_fd, prog_fd; in test_stacktrace_build_id_nmi() local 49 pmu_fd = syscall(__NR_perf_event_open, &attr, -1 /* pid */, in test_stacktrace_build_id_nmi() 52 if (CHECK(pmu_fd < 0, "perf_event_open", in test_stacktrace_build_id_nmi() 54 pmu_fd, errno)) in test_stacktrace_build_id_nmi() 57 link = bpf_program__attach_perf_event(prog, pmu_fd); in test_stacktrace_build_id_nmi() 60 close(pmu_fd); in test_stacktrace_build_id_nmi()
|
/Linux-v5.4/tools/testing/selftests/bpf/ |
D | get_cgroup_id_user.c | 52 int err, bytes, efd, prog_fd, pmu_fd; in main() local 112 pmu_fd = syscall(__NR_perf_event_open, &attr, getpid(), -1, -1, 0); in main() 113 if (CHECK(pmu_fd < 0, "perf_event_open", "err %d errno %d\n", pmu_fd, in main() 117 err = ioctl(pmu_fd, PERF_EVENT_IOC_ENABLE, 0); in main() 122 err = ioctl(pmu_fd, PERF_EVENT_IOC_SET_BPF, prog_fd); in main() 143 close(pmu_fd); in main()
|