Skip to content

Update AMD GPU code to add Power Usage sensor

I've updated the relevant code in the AMD GPU files to access the sysfs and retrieve the power metrics for the AMD GPUs, namely the following:

[DevicePath]/hwmon/hwmonX/power1_average (updates the value)
[DevicePath]/hwmon/hwmonX/power1_cap_min (updates the Min value)
[DevicePath]/hwmon/hwmonX/power1_cap_default (updates the Max value)

The code also looks for the relevant hwmon/hwmonX folder, as X could change between systems. It essentially searches the [DevicePath]/hwmon/* directory for the hwmon* pattern and uses the first directory that matches the pattern (which should always be a single directory, as the hwmon path is specific to the device).

The code compiles and runs fine (it has been tested a few dozen times) and example output can be seen below:
AMD_power_usage_example_output

The sensor placement can be seen below:
AMD_power_usage_sensor_placement

The code has been compiled and tested against a system with the following info:
about_system

Edited by Stavros Karpozilos

Merge request reports