cpu module: Reuse getCpuUsage of cpu_usage module

This commit is contained in:
Mann mit Hut
2023-07-29 15:56:51 +02:00
parent c45f6681b3
commit d1602e383c
7 changed files with 13 additions and 172 deletions

View File

@ -22,8 +22,6 @@ class Cpu : public ALabel {
private:
double getCpuLoad();
std::tuple<std::vector<uint16_t>, std::string> getCpuUsage();
std::vector<std::tuple<size_t, size_t>> parseCpuinfo();
std::vector<std::tuple<size_t, size_t>> prev_times_;

View File

@ -20,9 +20,11 @@ class CpuUsage : public ALabel {
virtual ~CpuUsage() = default;
auto update() -> void override;
// This is a static member because it is also used by the cpu module.
static std::tuple<std::vector<uint16_t>, std::string> getCpuUsage(std::vector<std::tuple<size_t, size_t>>&);
private:
std::tuple<std::vector<uint16_t>, std::string> getCpuUsage();
std::vector<std::tuple<size_t, size_t>> parseCpuinfo();
static std::vector<std::tuple<size_t, size_t>> parseCpuinfo();
std::vector<std::tuple<size_t, size_t>> prev_times_;