[OS] Why the function of cpu_freq() always getting the cpu default freq?
Summary
- OS: Windows11 Home
- Architecture: 64bit
- Psutil version: 5.8.0
- Python version: 3.9.7(Base on Conda)
- Type: BugIssuses
Description
Yeah,pretty confusing that i wanna using Flask and Psutil to make a monitor system,and yet the cpu_freq() functions seems doesnt work to detect freq?

But in fact is:my cpu turboing very well.
So how should i fix that or otherwise is bottom layer issuses?
Seems it's hardcoded that way:
def cpu_freq():
"""Return CPU frequency.
On Windows per-cpu frequency is not supported.
"""
curr, max_ = cext.cpu_freq()
min_ = 0.0
return [_common.scpufreq(float(curr), min_, float(max_))]
In the implementation the call to GetNTPowerInformation() returns a ncpu-sized array of PROCESSOR_POWER_INFORMATION structures but only the first one is fetched. (Note: on systems with more than 64 logical processor groups this only returns the values for one group.)
I recall going down this road and think perhaps I saw that the frequencies were all the same here so this code may be acknowledging the API limitation.
A better source of processor frequency information is the performance counters: Processor Information\% of Maximum Frequency returns a value 0 to 100 that can be multiplied by max freq (and divided by 100) to calculate it.
Close this issuse due to unknow reasons