Files
MuditaOS/module-sys/SystemManager/cpu/algorithm/ImmediateUpscale.cpp
Maciej Gibowicz cbe1ed63e5 [BH-1801] Fix incorrect calculation of requested CPU frequency
Sometimes when the frequency is locked, e.g. at 132 MHz, the algorithm
still calculated a lower frequency, e.g. 66 MHz.
2023-10-27 12:23:12 +02:00

18 lines
556 B
C++

// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "ImmediateUpscale.hpp"
namespace sys::cpu
{
AlgorithmResult ImmediateUpscale::calculateImplementation(const AlgorithmData &data)
{
const auto now = data.sentinel.minFrequency;
const auto was = data.curentFrequency;
if (now > was) {
return {algorithm::Change::UpScaled, now};
}
return {algorithm::Change::NoChange, was};
}
} // namespace sys::cpu