Continuous energy profiling using eBPF and RAPL #3738
mahendrapaipuri
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello all,
Currently the eBPF based continuous profiler supports CPU profiling. The idea here is can we extend it to profile the energy consumption of the applications?
On Intel and AMD chips, Linux's powercap module exposes RAPL energy counters for sockets (and DRAM). For the each collect interval, CPU profiling data gives us the time spent by the application in different functions. If we know the energy consumed by the application within that collect interval, splitting that energy amongst different functions is trivial with stack's histogram data. The RAPL counters are only available at the granularity of CPU socket. A basic approximation would be to estimate the energy usage of the process based on its self CPU time and total CPU time in the last collect interval. And this can be entirely done on the userspace eBPF code. A more accurate approximation would be to keep track of processes CPU socket during migrations and then estimate the energy consumption by taking counters of each CPU socket into account.
The end product would be we get energy profiling data just like CPU profiling data. Although it might not look very different from CPU profiling in terms of trend, it might be a useful tool for reporting.
AMD does expose per-core RAPL counters and there is a patch proposed to expose them using
perf
. If and when this patch gets merged into kernel, we can extend this approach to do a more accurate energy profiling of applications that can help the developers to get accurate picture of energy hotspots of the programs.Is it something feasible and does the community sees a value in it?
Cheers!
Beta Was this translation helpful? Give feedback.
All reactions