~aleteoryx/muditaos

919288eef2de2cecc3ac217b8768b70d65fe0d0e — Maciej Gibowicz 1 year, 9 months ago 4a9f6e2
[BH-1950] Fix incorrect Power Management statistics in the logs

When the CPU is in WFI mode, the CPU usage statistics should only
reflect the WFI range and not the other frequency ranges.
M harmony_changelog.md => harmony_changelog.md +1 -0
@@ 5,6 5,7 @@
### Fixed
* Fixed the backlight blink in pre-wake up
* Fixed missing tooltip text in Onboarding in French
* Fixed incorrect Power Management statistics in the logs

### Added
* Added custom alarms functionality

M module-sys/SystemManager/PowerManager.cpp => module-sys/SystemManager/PowerManager.cpp +7 -6
@@ 219,12 219,7 @@ namespace sys
                             ? lowestLevelName
                             : (currentFreq == bsp::CpuFrequencyMHz::Level_6 ? highestLevelName : middleLevelName);

        for (auto &level : cpuFrequencyMonitors) {
            if (level.GetName() == levelName) {
                level.IncreaseTicks(ticks - lastCpuFrequencyChangeTimestamp);
            }
        }

        UpdateCpuFrequencyMonitor(levelName, ticks - lastCpuFrequencyChangeTimestamp);
        lastCpuFrequencyChangeTimestamp = ticks;
    }



@@ 237,6 232,11 @@ namespace sys
        }
    }

    void PowerManager::UpdateCpuFrequencyMonitorTimestamp()
    {
        lastCpuFrequencyChangeTimestamp = xTaskGetTickCount();
    }

    void PowerManager::EnterWfiIfReady()
    {
        if (cpuGovernor->IsWfiBlocked()) {


@@ 254,6 254,7 @@ namespace sys
            lowPowerControl->EnableSysTick();
            portEXIT_CRITICAL();
            UpdateCpuFrequencyMonitor(WfiName, timeSpentInWFI);
            UpdateCpuFrequencyMonitorTimestamp();
        }
    }


M module-sys/SystemManager/include/SystemManager/PowerManager.hpp => module-sys/SystemManager/include/SystemManager/PowerManager.hpp +1 -0
@@ 76,6 76,7 @@ namespace sys
        void SetCpuFrequency(bsp::CpuFrequencyMHz freq);
        void UpdateCpuFrequencyMonitor(bsp::CpuFrequencyMHz currentFreq);
        void UpdateCpuFrequencyMonitor(const std::string &name, std::uint32_t tickIncrease);
        void UpdateCpuFrequencyMonitorTimestamp();
        [[nodiscard]] auto GetMinimumCpuFrequencyRequested() const noexcept -> sentinel::View;

        TickType_t lastCpuFrequencyChangeTimestamp{0};