I'm looking for a tool or some source code (VC/VB) that would enable me to watch CPU power consumption on an HP server
(HP ProLiant DL380 Gen 10 - CentOS7 , 2 X SkyLake CPUs).
So far no success,
Only tool I've found names s-tui can monitor one CPU only (the first one),
All the other monitoring tools do not show CPU real time power consumption in watts. (NetData etc...)
Thanks a lot,
Typically I would suggest turbostat, but it is kernel version specific and a quick search suggests Skylake was not added until 4.1. Assume your CentOS 7 is running an old 3.x kernel?
Power is not difficult to calculate via the RAPL energy counters. Userland access was added in kernel 3.13 via /sys/class/powercap/intel-rapl/intel-rapl:0/. The file "energy_uj" exposes the CPU energy usage in microjoules. (Unsure how it is exposed per socket, but assume it is via multiple paths/files.) Take a couple of samples (with a known delay in between) and convert to watts.
The "msr-tools" package provides rdmsr as an alternative approach (requires root). The latter requires reading MSR PKG_ENERGY_STATUS scaled by MSR RAPL_POWER_UNIT (for the energy unit) and then divided by elapsed time for watts. The longer/more-accurate your sample-to-sample time, the less jitter and higher accuracy but with more averaging.
The /sys/class/powercap devices support SKX and CLX in CentOS 7.6. I don't think this interface worked in CentOS 7.4 (and we skipped 7.5).
Our CentOS7.6 kernel is 3.10.0-957.27.2.el7.x86_64