return 0;
}
-SEC("perf_event/1")
+SEC("perf_event")
int on_cache_miss(struct bpf_perf_event_data *ctx)
{
return trace_event(ctx->sample_period, true);
}
-SEC("perf_event/2")
+SEC("perf_event")
int on_cache_ref(struct bpf_perf_event_data *ctx)
{
return trace_event(ctx->sample_period, false);
return -1;
}
links[i] = bpf_program__attach_perf_event(prog, fd);
- if (libbpf_get_error(links[i])) {
- fprintf(stderr, "failed to attach perf event on cpu: "
- "%d\n", i);
- links[i] = NULL;
+ if (!links[i]) {
+ fprintf(stderr, "failed to attach perf event on cpu: %d\n", i);
close(fd);
return -1;
}
if (err)
return err;
+ libbpf_set_strict_mode(LIBBPF_STRICT_ALL);
libbpf_set_print(libbpf_print_fn);
- err = bump_memlock_rlimit();
- if (err) {
- fprintf(stderr, "failed to increase rlimit: %d\n", err);
- return 1;
- }
-
nr_cpus = libbpf_num_possible_cpus();
if (nr_cpus < 0) {
fprintf(stderr, "failed to get # of possible cpus: '%s'!\n",