From e0fa943b7f0d3a3c2938bd8bc077b7f288c7427e Mon Sep 17 00:00:00 2001 From: kobayu858 <129580202+kobayu858@users.noreply.github.com> Date: Fri, 9 Aug 2024 14:55:08 +0900 Subject: [PATCH] fix(system_monitor): fix unreadVariable (#8372) fix:unreadVariable Signed-off-by: kobayu858 --- system/system_monitor/src/cpu_monitor/intel_cpu_monitor.cpp | 4 +--- system/system_monitor/src/gpu_monitor/nvml_gpu_monitor.cpp | 6 ++---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/system/system_monitor/src/cpu_monitor/intel_cpu_monitor.cpp b/system/system_monitor/src/cpu_monitor/intel_cpu_monitor.cpp index 1e6325d9c452b..54d0ee33a4fa1 100644 --- a/system/system_monitor/src/cpu_monitor/intel_cpu_monitor.cpp +++ b/system/system_monitor/src/cpu_monitor/intel_cpu_monitor.cpp @@ -130,16 +130,14 @@ void CPUMonitor::checkThrottling(diagnostic_updater::DiagnosticStatusWrapper & s return; } - int level = DiagStatus::OK; int whole_level = DiagStatus::OK; int index = 0; for (auto itr = info.pkg_thermal_status_.begin(); itr != info.pkg_thermal_status_.end(); ++itr, ++index) { + int level = DiagStatus::OK; if (*itr) { level = DiagStatus::ERROR; - } else { - level = DiagStatus::OK; } stat.add(fmt::format("CPU {}: Pkg Thermal Status", index), thermal_dict_.at(level)); diff --git a/system/system_monitor/src/gpu_monitor/nvml_gpu_monitor.cpp b/system/system_monitor/src/gpu_monitor/nvml_gpu_monitor.cpp index d5aecfed04805..0000d6ead1c6a 100644 --- a/system/system_monitor/src/gpu_monitor/nvml_gpu_monitor.cpp +++ b/system/system_monitor/src/gpu_monitor/nvml_gpu_monitor.cpp @@ -130,7 +130,6 @@ void GPUMonitor::checkUsage(diagnostic_updater::DiagnosticStatusWrapper & stat) // Remember start time to measure elapsed time const auto t_start = SystemMonitorUtility::startMeasurement(); - int level = DiagStatus::OK; int whole_level = DiagStatus::OK; int index = 0; nvmlReturn_t ret{}; @@ -150,7 +149,7 @@ void GPUMonitor::checkUsage(diagnostic_updater::DiagnosticStatusWrapper & stat) return; } - level = DiagStatus::OK; + int level = DiagStatus::OK; float usage = static_cast(itr->utilization.gpu) / 100.0; if (usage >= gpu_usage_error_) { level = std::max(level, static_cast(DiagStatus::ERROR)); @@ -264,7 +263,6 @@ void GPUMonitor::checkMemoryUsage(diagnostic_updater::DiagnosticStatusWrapper & // Remember start time to measure elapsed time const auto t_start = SystemMonitorUtility::startMeasurement(); - int level = DiagStatus::OK; int whole_level = DiagStatus::OK; int index = 0; nvmlReturn_t ret{}; @@ -286,7 +284,7 @@ void GPUMonitor::checkMemoryUsage(diagnostic_updater::DiagnosticStatusWrapper & return; } - level = DiagStatus::OK; + int level = DiagStatus::OK; float usage = static_cast(itr->utilization.memory) / 100.0; if (usage >= memory_usage_error_) { level = std::max(level, static_cast(DiagStatus::ERROR));