small fix for average cpu_power 2

This commit is contained in:
sfrcorne 2023-04-04 20:40:31 +02:00 committed by flightlessmango
parent 2187b9ef19
commit 020e8485e2

View File

@ -88,7 +88,7 @@ void amdgpu_get_instant_metrics(struct amdgpu_common_metrics *metrics) {
metrics->average_gfx_power_w = amdgpu_metrics->average_gfx_power / 1000.f;
if( IS_VALID_METRIC(amdgpu_metrics->average_cpu_power) && IS_VALID_METRIC(amdgpu_metrics->average_soc_power) ) {
if( IS_VALID_METRIC(amdgpu_metrics->average_cpu_power) ) {
// prefered method
metrics->average_cpu_power_w = amdgpu_metrics->average_cpu_power / 1000.f;
} else if( IS_VALID_METRIC(amdgpu_metrics->average_core_power[0]) ) {
@ -99,10 +99,7 @@ void amdgpu_get_instant_metrics(struct amdgpu_common_metrics *metrics) {
} else if( IS_VALID_METRIC(amdgpu_metrics->average_socket_power) && IS_VALID_METRIC(amdgpu_metrics->average_gfx_power) ) {
// fallback 2: estimate cpu power from total socket power
metrics->average_cpu_power_w = amdgpu_metrics->average_socket_power / 1000.f - amdgpu_metrics->average_gfx_power / 1000.f;
} else if( IS_VALID_METRIC(amdgpu_metrics->average_cpu_power) ) {
// fallback 3: Ignore 'soc power' if not available
metrics->average_cpu_power_w = amdgpu_metrics->average_cpu_power / 1000.f;
} else {
} else {
// giving up
metrics->average_cpu_power_w = 0;
}