kepler icon indicating copy to clipboard operation
kepler copied to clipboard

CPU Ref Cycles in unused

Open dave-tucker opened this issue 1 year ago • 0 comments

What would you like to be added?

In working on #1398 I found that there are a number of unused eBPF maps.

See here: https://github.com/sustainable-computing-io/kepler/blob/main/bpfassets/bcc/bcc.c#L217

That the variable on_cpu_avg_freq is not used, therefore the function get_on_cpu_avg_freq and the map cpu_freq_array are also unused.

Following that through, the same is then true of on_cpu_ref_cycles_delta, which gets populated by get_on_cpu_ref_cycles and uses the maps cpu_ref_cycles and cpu_ref_cycles_hc_reader.

In addition, the global variables HZ and CPU_REF_FREQ are also unused. N.B - SAMPLE_RATE wasn't being correctly populated before #1398 but it is now.

Before I remove all of this unused code it would be excellent to get some clarification on whether it is intended to be used or not.

cc @marceloamaral

Why is this needed?

In particular, the perf event array cpu_ref_cycles_hc_reader is populated by a hardware perf event and it's my understanding that these are a scarce resource. If we aren't intending to use it, then we should not open a perf event of this type/event.

dave-tucker avatar May 03 '24 18:05 dave-tucker