Files
MuditaOS/module-sys/SystemManager/CpuStatistics.hpp
Maciej Gibowicz 9c9e921ab4 [EGD-4693] PowerManagement: CPU load measurement (#1156)
Add FreeRTOS idle tasks Run Time Statistics

This will allow to measure the CPU load
2020-12-10 17:27:54 +01:00

27 lines
560 B
C++

// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
#include <cstdint>
namespace sys
{
class CpuStatistics
{
public:
void Update();
[[nodiscard]] uint32_t GetPercentageCpuLoad() const noexcept;
private:
uint32_t ComputeIncrease(uint32_t currentCount, uint32_t lastCount) const;
uint32_t lastIdleTickCount{0};
uint32_t lastTotalTickCount{0};
uint32_t cpuLoad{0};
};
} // namespace sys