Skip to content

Commit

Permalink
fix(bpf): get_on_cpu_cycles not returning delta
Browse files Browse the repository at this point in the history
Current code assigns val to c.counter, which is always
0 since it's not used by bpf_perf_event_read_value -
we're using bpf_perf_event_read in this function since the
former produces a strange verifier error.

Fixes: #1402

Signed-off-by: Dave Tucker <[email protected]>
  • Loading branch information
dave-tucker committed May 7, 2024
1 parent 18f8d2b commit 9f3943a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bpfassets/libbpf/src/kepler.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ static inline u64 get_on_cpu_cycles(u32 *cpu_id)
if (error < 0) {
return delta;
}
val = c.counter;
val = error;
prev_val = bpf_map_lookup_elem(&cpu_cycles, cpu_id);
delta = calc_delta(prev_val, &val);
bpf_map_update_elem(&cpu_cycles, cpu_id, &val, BPF_ANY);
Expand Down

0 comments on commit 9f3943a

Please sign in to comment.