-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
新增Lite版显示频率的功能,修正ARM64EC显示CPU频率不正常的问题
- Loading branch information
1 parent
04f4bb3
commit 655bc9c
Showing
9 changed files
with
210 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,41 @@ | ||
#pragma once | ||
#include <Pdh.h> | ||
#include <PdhMsg.h> | ||
#pragma comment(lib,"pdh.lib") | ||
|
||
class CCPUUsage | ||
{ | ||
public: | ||
CCPUUsage() | ||
{} | ||
CCPUUsage() | ||
{} | ||
|
||
~CCPUUsage() | ||
{} | ||
~CCPUUsage() | ||
{} | ||
|
||
void SetUseCPUTimes(bool use_get_system_times); //设置获取CPU利用率的方式,是通过GetSystemTimes还是Pdh | ||
int GetCPUUsage(); | ||
void SetUseCPUTimes(bool use_get_system_times); //设置获取CPU利用率的方式,是通过GetSystemTimes还是Pdh | ||
int GetCPUUsage(); | ||
|
||
private: | ||
int GetCPUUsageByGetSystemTimes(); | ||
int GetCPUUsageByPdh(); | ||
int GetCPUUsageByGetSystemTimes(); | ||
int GetCPUUsageByPdh(); | ||
|
||
private: | ||
bool m_use_get_system_times{ true }; //是否使用GetSysTime这个API来获取CPU利用率 | ||
bool m_use_get_system_times{ true }; //是否使用GetSysTime这个API来获取CPU利用率 | ||
|
||
PDH_RAW_COUNTER m_last_rawData;//保存计算CPU使用率的上一次数据 | ||
bool m_first_get_CPU_utility{ true }; | ||
PDH_RAW_COUNTER m_last_rawData{};//保存计算CPU使用率的上一次数据 | ||
bool m_first_get_CPU_utility{ true }; | ||
|
||
FILETIME m_preidleTime{}; | ||
FILETIME m_prekernelTime{}; | ||
FILETIME m_preuserTime{}; | ||
FILETIME m_preidleTime{}; | ||
FILETIME m_prekernelTime{}; | ||
FILETIME m_preuserTime{}; | ||
|
||
}; | ||
|
||
class CCpuFreq | ||
{ | ||
public: | ||
CCpuFreq(); | ||
float GetCpuFreq(); | ||
|
||
private: | ||
float max_cpu_freq = 0; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.