scaphandre icon indicating copy to clipboard operation
scaphandre copied to clipboard

Power of 0 returned for all processes on Ubuntu 22.04.1 LTS

Open netzdoktor opened this issue 2 years ago • 2 comments

Bug description

On my system, running scaphandre stdout -t 15 returns 0 W for all processes.

To Reproduce

> scaphandre stdout -t 15
Scaphandre stdout exporter
Sending ⚡ metrics
Measurement step is: 2s
Host:   0 W
        package         core            uncore
Top 5 consumers:
Power           PID     Exe
No processes found yet or filter returns no value.
------------------------------------------------------------

Host:   0 W
        package         core            uncore
Top 5 consumers:
Power           PID     Exe
0 W     2748    "gnome-shell"
0 W     12498   "Isolated Web Co"
0 W     13      "rcu_sched"
0 W     147     "kworker/3:1H-events_highpri"
0 W     840     "kworker/u16:14-kcryptd/253:0"
------------------------------------------------------------

Host:   0 W
        package         core            uncore
Top 5 consumers:
Power           PID     Exe
0 W     2748    "gnome-shell"
0 W     1463    "containerd"
0 W     3172    "Xwayland"
0 W     3407    "gnome-terminal-"
0 W     1       "systemd"
------------------------------------------------------------

Expected behavior

The power values should be non-zero.

Screenshots

None

Environment

> lsb_release -d
Description: Ubuntu 22.04.1 LTS
> uname -r
5.15.0-47-generic
> lsmod | grep intel_rapl
intel_rapl_msr         20480  0
intel_rapl_common      40960  2 intel_rapl_msr,processor_thermal_rapl
> find rapl /usr
/usr/bin/rapl-info
/usr/bin/rapl-set
/usr/share/man/man1/rapl-set.1.gz
/usr/share/man/man1/rapl-info.1.gz
/usr/local/share/man/man1/energymon-rapl-idle-power.1
/usr/local/share/man/man1/energymon-rapl-overhead.1
/usr/local/share/man/man1/energymon-rapl-cmd-profile.1
/usr/local/share/man/man1/energymon-rapl-power-poller.1
/usr/local/share/man/man1/energymon-rapl-info.1
/usr/local/share/man/man1/energymon-rapl-file-provider.1
/usr/local/include/energymon/energymon-rapl.h
/usr/local/bin/energymon-rapl-power-poller
/usr/local/bin/energymon-rapl-cmd-profile
/usr/local/bin/energymon-rapl-overhead
/usr/local/bin/energymon-rapl-info
/usr/local/bin/energymon-rapl-file-provider
/usr/local/bin/energymon-rapl-idle-power
/usr/local/lib/libenergymon-rapl.a
/usr/local/lib/pkgconfig/energymon-rapl.pc
/usr/lib/modules/5.10.0-1057-oem/kernel/arch/x86/events/rapl.ko
/usr/lib/modules/5.10.0-1057-oem/kernel/drivers/powercap/intel_rapl_common.ko
/usr/lib/modules/5.10.0-1057-oem/kernel/drivers/powercap/intel_rapl_msr.ko
/usr/lib/modules/5.15.0-47-generic/kernel/arch/x86/events/rapl.ko
/usr/lib/modules/5.15.0-47-generic/kernel/drivers/powercap/intel_rapl_msr.ko
/usr/lib/modules/5.15.0-47-generic/kernel/drivers/powercap/intel_rapl_common.ko
/usr/lib/modules/5.15.0-47-generic/kernel/drivers/thermal/intel/int340x_thermal/processor_thermal_rapl.ko
/usr/lib/modules/5.15.0-46-generic/kernel/arch/x86/events/rapl.ko
/usr/lib/modules/5.15.0-46-generic/kernel/drivers/powercap/intel_rapl_msr.ko
/usr/lib/modules/5.15.0-46-generic/kernel/drivers/powercap/intel_rapl_common.ko
/usr/lib/modules/5.15.0-46-generic/kernel/drivers/thermal/intel/int340x_thermal/processor_thermal_rapl.ko
/usr/src/linux-headers-5.15.0-46/include/linux/intel_rapl.h
/usr/src/linux-headers-5.15.0-47/include/linux/intel_rapl.h
/usr/src/linux-headers-5.10.0-1057-oem/include/config/intel/rapl.h
/usr/src/linux-headers-5.10.0-1057-oem/include/config/intel/rapl
/usr/src/linux-headers-5.15.0-47-generic/include/config/PERF_EVENTS_INTEL_RAPL
/usr/src/linux-headers-5.15.0-46-generic/include/config/PERF_EVENTS_INTEL_RAPL
/usr/src/linux-headers-5.15.0-47-generic/include/config/INTEL_RAPL
/usr/src/linux-headers-5.15.0-46-generic/include/config/INTEL_RAPL
/usr/src/linux-headers-5.10.0-1057-oem/include/config/perf/events/intel/rapl.h
/usr/src/linux-headers-5.10.0-1057-oem/include/config/proc/thermal/mmio/rapl.h
/usr/src/linux-headers-5.15.0-47-generic/include/config/INTEL_RAPL_CORE
/usr/src/linux-headers-5.15.0-47-generic/include/config/PROC_THERMAL_MMIO_RAPL
/usr/src/linux-headers-5.15.0-46-generic/include/config/INTEL_RAPL_CORE
/usr/src/linux-headers-5.15.0-46-generic/include/config/PROC_THERMAL_MMIO_RAPL
/usr/src/linux-oem-5.10-headers-5.10.0-1057/include/linux/intel_rapl.h

Additional context

None

netzdoktor avatar Sep 08 '22 08:09 netzdoktor

Hi,

This is most the time a problem of permissions in /sys/class/powercap. Could you run the init.sh script at the root of the project then retry ?

bpetit avatar Sep 08 '22 15:09 bpetit

Indeed, sudo scaphandre did the trick. I wonder whether replying with 0W is the proper handling of missing permissions. It's not completely misleading (as 0W is obviously non-sense), but program failure or more elaborate output would be more sensible?

If you agree, I could help implement it, as I have some Rust experience.

netzdoktor avatar Sep 09 '22 08:09 netzdoktor

Makes me think of https://github.com/hubblo-org/scaphandre/issues/137

demeringo avatar Oct 04 '22 11:10 demeringo

Hi !

It's been a long time now but if you're still up to propose a PR on this @netzdoktor it would be more than welcome !

Otherwise I might try something in the direction you proposed.

Btw @demeringo I think this one is not so related to #137 as it is more about RAPL support on the CPU. No such support gives an explicit error, while the behavior described here is more silent as described @netzdoktor and returns 0 :)

bpetit avatar Aug 14 '23 12:08 bpetit

I close the issue as the latest code in dev branch includes warnings messages when permissions are not okay.

It doesn't make the app crash, but makes the problem pretty obvious now.

We could open a new issue afterwards if we realize making the program crash in such case is a way better option.

bpetit avatar Dec 15 '23 17:12 bpetit