fix(sys-clk-oc): fix governor not setting clocks correctly: fixes #1
- move hz check from ApplyTargetFreq to caller
This commit is contained in:
@@ -143,6 +143,8 @@ namespace GovernorImpl {
|
|||||||
// Utilization is frequency-invariant (normalized):
|
// Utilization is frequency-invariant (normalized):
|
||||||
// target_freq = C * max_freq(ref_freq) * util / max
|
// target_freq = C * max_freq(ref_freq) * util / max
|
||||||
void BaseGovernor::ApplyNewFreqFromNormUtil(uint32_t normUtil) {
|
void BaseGovernor::ApplyNewFreqFromNormUtil(uint32_t normUtil) {
|
||||||
|
uint32_t curr_hz = m_target_hz;
|
||||||
|
|
||||||
auto FindHzInTable = [](uint32_t* list, uint32_t hz) -> uint32_t {
|
auto FindHzInTable = [](uint32_t* list, uint32_t hz) -> uint32_t {
|
||||||
uint32_t* p = list;
|
uint32_t* p = list;
|
||||||
for (; *p != 0; p++) {
|
for (; *p != 0; p++) {
|
||||||
@@ -163,7 +165,8 @@ void BaseGovernor::ApplyNewFreqFromNormUtil(uint32_t normUtil) {
|
|||||||
else
|
else
|
||||||
new_hz = FindHzInTable(m_hz_list, next_freq);
|
new_hz = FindHzInTable(m_hz_list, next_freq);
|
||||||
|
|
||||||
ApplyTargetFreq(new_hz);
|
if (new_hz != curr_hz)
|
||||||
|
ApplyTargetFreq(new_hz);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CpuGovernor::GovernorWorker::Start() {
|
void CpuGovernor::GovernorWorker::Start() {
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ namespace GovernorImpl {
|
|||||||
void ApplyNewFreqFromNormUtil(uint32_t norm);
|
void ApplyNewFreqFromNormUtil(uint32_t norm);
|
||||||
|
|
||||||
void ApplyTargetFreq(uint32_t hz) {
|
void ApplyTargetFreq(uint32_t hz) {
|
||||||
if (!hz || m_target_hz == hz)
|
if (!hz)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_target_hz = hz;
|
m_target_hz = hz;
|
||||||
|
|||||||
Reference in New Issue
Block a user