Skip to content

Commit 33b8f90

Browse files
committed
修正Lite版显示显卡和硬盘利用率时,有时会显示“--”的问题
1 parent dd187f6 commit 33b8f90

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

TrafficMonitor/TrafficMonitorDlg.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,13 +1357,6 @@ void CTrafficMonitorDlg::DoMonitorAcquisition()
13571357
bool gpu_usage_acquired = false;
13581358
m_get_disk_usage_by_pdh = false;
13591359

1360-
theApp.m_cpu_temperature = -1;
1361-
theApp.m_gpu_temperature = -1;
1362-
theApp.m_hdd_temperature = -1;
1363-
theApp.m_main_board_temperature = -1;
1364-
theApp.m_gpu_usage = -1;
1365-
theApp.m_hdd_usage = -1;
1366-
13671360
//获取CPU使用率
13681361
if (lite_version || theApp.m_general_data.cpu_usage_acquire_method != GeneralSettingData::CA_HARDWARE_MONITOR || !theApp.m_general_data.IsHardwareEnable(HI_CPU))
13691362
{
@@ -1384,6 +1377,8 @@ void CTrafficMonitorDlg::DoMonitorAcquisition()
13841377
if (m_gpu_usage_helper.GetGpuUsage(theApp.m_gpu_usage))
13851378
gpu_usage_acquired = true;
13861379
}
1380+
if (!gpu_usage_acquired)
1381+
theApp.m_gpu_usage = -1;
13871382

13881383
//获取硬盘利用率
13891384
if (lite_version /*|| is_arm64ec*/ || !theApp.m_general_data.IsHardwareEnable(HI_HDD))
@@ -1411,6 +1406,8 @@ void CTrafficMonitorDlg::DoMonitorAcquisition()
14111406
if (m_disk_usage_helper.GetDiskUsage(disk_index, theApp.m_hdd_usage))
14121407
m_get_disk_usage_by_pdh = true;
14131408
}
1409+
if (!m_get_disk_usage_by_pdh)
1410+
theApp.m_hdd_usage = -1;
14141411

14151412
//获取内存利用率
14161413
MEMORYSTATUSEX statex;
@@ -1421,6 +1418,10 @@ void CTrafficMonitorDlg::DoMonitorAcquisition()
14211418
theApp.m_total_memory = static_cast<int>(statex.ullTotalPhys / 1024);
14221419

14231420
#ifndef WITHOUT_TEMPERATURE
1421+
theApp.m_cpu_temperature = -1;
1422+
theApp.m_gpu_temperature = -1;
1423+
theApp.m_hdd_temperature = -1;
1424+
theApp.m_main_board_temperature = -1;
14241425
//获取温度
14251426
if (IsTemperatureNeeded() && theApp.m_pMonitor != nullptr)
14261427
{

0 commit comments

Comments
 (0)