Skip to content

Commit b652472

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

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

TrafficMonitor/TrafficMonitorDlg.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,9 +1376,9 @@ void CTrafficMonitorDlg::DoMonitorAcquisition()
13761376
{
13771377
if (m_gpu_usage_helper.GetGpuUsage(theApp.m_gpu_usage))
13781378
gpu_usage_acquired = true;
1379+
else
1380+
theApp.m_gpu_usage = -1;
13791381
}
1380-
if (!gpu_usage_acquired)
1381-
theApp.m_gpu_usage = -1;
13821382

13831383
//获取硬盘利用率
13841384
if (lite_version /*|| is_arm64ec*/ || !theApp.m_general_data.IsHardwareEnable(HI_HDD))
@@ -1405,9 +1405,9 @@ void CTrafficMonitorDlg::DoMonitorAcquisition()
14051405
}
14061406
if (m_disk_usage_helper.GetDiskUsage(disk_index, theApp.m_hdd_usage))
14071407
m_get_disk_usage_by_pdh = true;
1408+
else
1409+
theApp.m_hdd_usage = -1;
14081410
}
1409-
if (!m_get_disk_usage_by_pdh)
1410-
theApp.m_hdd_usage = -1;
14111411

14121412
//获取内存利用率
14131413
MEMORYSTATUSEX statex;
@@ -1418,10 +1418,6 @@ void CTrafficMonitorDlg::DoMonitorAcquisition()
14181418
theApp.m_total_memory = static_cast<int>(statex.ullTotalPhys / 1024);
14191419

14201420
#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;
14251421
//获取温度
14261422
if (IsTemperatureNeeded() && theApp.m_pMonitor != nullptr)
14271423
{

0 commit comments

Comments
 (0)