Error if power metric inaccessible

Change-Id: I359c24f24d0200181646d5a7c13a6e0e4d4958b6
Signed-off-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>
Bu işleme şunda yer alıyor:
Galantsev, Dmitrii
2024-04-25 00:41:27 -05:00
ebeveyn 5525bf8c86
işleme 1f5fa94132
2 değiştirilmiş dosya ile 19 ekleme ve 6 silme
+6 -3
Dosyayı Görüntüle
@@ -117,16 +117,19 @@ rdc_status_t RdcEmbeddedHandler::get_gpu_gauges(rdc_gpu_gauges_t* gpu_gauges) {
RDC_LOG(RDC_ERROR, "Fail to get total memory of GPU " << gpu_index_list[i]);
return status;
}
gpu_gauges->insert({{gpu_index_list[i], RDC_FI_GPU_MEMORY_TOTAL}, value.value.l_int});
gpu_gauges->insert(
{{gpu_index_list[i], RDC_FI_GPU_MEMORY_TOTAL}, static_cast<uint64_t>(value.value.l_int)});
status = metric_fetcher_->fetch_smi_field(gpu_index_list[i], RDC_FI_ECC_CORRECT_TOTAL, &value);
if (status == RDC_ST_OK) {
gpu_gauges->insert({{gpu_index_list[i], RDC_FI_ECC_CORRECT_TOTAL}, value.value.l_int});
gpu_gauges->insert({{gpu_index_list[i], RDC_FI_ECC_CORRECT_TOTAL},
static_cast<uint64_t>(value.value.l_int)});
}
status =
metric_fetcher_->fetch_smi_field(gpu_index_list[i], RDC_FI_ECC_UNCORRECT_TOTAL, &value);
if (status == RDC_ST_OK) {
gpu_gauges->insert({{gpu_index_list[i], RDC_FI_ECC_UNCORRECT_TOTAL}, value.value.l_int});
gpu_gauges->insert({{gpu_index_list[i], RDC_FI_ECC_UNCORRECT_TOTAL},
static_cast<uint64_t>(value.value.l_int)});
}
}
return RDC_ST_OK;
+13 -3
Dosyayı Görüntüle
@@ -32,6 +32,7 @@ THE SOFTWARE.
#include "amd_smi/amdsmi.h"
#include "common/rdc_capabilities.h"
#include "common/rdc_fields_supported.h"
#include "rdc/rdc.h"
#include "rdc_lib/RdcLogger.h"
#include "rdc_lib/impl/SmiUtils.h"
#include "rdc_lib/rdc_common.h"
@@ -436,17 +437,26 @@ rdc_status_t RdcMetricFetcherImpl::fetch_smi_field(uint32_t gpu_index, rdc_field
value->status = amdsmi_get_power_info(processor_handle, &power_info);
value->type = INTEGER;
if (value->status != AMDSMI_STATUS_SUCCESS) {
RDC_LOG(RDC_ERROR, "amdsmi_get_power_info failed!");
break;
}
// Use current_socket_power if average_socket_power is not available
if (power_info.average_socket_power != 65535) {
RDC_LOG(RDC_DEBUG, "AMDSMI: using average_socket_power");
value->value.l_int = static_cast<int64_t>(power_info.average_socket_power) * 1000 * 1000;
} else {
value->value.l_int = static_cast<int64_t>(power_info.current_socket_power) * 1000 * 1000;
break;
}
break;
if (power_info.current_socket_power != 65535) {
RDC_LOG(RDC_DEBUG, "AMDSMI: using current_socket_power");
value->value.l_int = static_cast<int64_t>(power_info.current_socket_power) * 1000 * 1000;
break;
}
value->status = AMDSMI_STATUS_NOT_SUPPORTED;
RDC_LOG(RDC_ERROR, "AMDSMI: cannot get POWER_USAGE");
return RDC_ST_NO_DATA;
}
case RDC_FI_GPU_CLOCK:
case RDC_FI_MEM_CLOCK: {