Decrease log spam in case that per core cpu usage cannot be queried

This commit is contained in:
Megamouse 2022-03-18 00:16:31 +01:00
parent 7a86cffd0a
commit 539ac32806
2 changed files with 5 additions and 1 deletions

View File

@ -125,6 +125,11 @@ namespace utils
}; };
#ifdef _WIN32 #ifdef _WIN32
if (!m_cpu_cores || !m_cpu_query)
{
perf_log.warning("Can not collect per core cpu usage: The required API is not initialized.");
return;
}
PDH_STATUS status = PdhCollectQueryData(m_cpu_query); PDH_STATUS status = PdhCollectQueryData(m_cpu_query);
if (ERROR_SUCCESS != status) if (ERROR_SUCCESS != status)

View File

@ -19,7 +19,6 @@ namespace utils
#ifdef _WIN32 #ifdef _WIN32
PDH_HQUERY m_cpu_query = nullptr; PDH_HQUERY m_cpu_query = nullptr;
PDH_HCOUNTER m_cpu_total = nullptr;
PDH_HCOUNTER m_cpu_cores = nullptr; PDH_HCOUNTER m_cpu_cores = nullptr;
#elif __linux__ #elif __linux__
size_t m_previous_idle_time_total = 0; size_t m_previous_idle_time_total = 0;