cpu: port parseCpuinfo to BSDs

This commit is contained in:
Jan Beich
2019-08-11 13:10:37 +00:00
parent c4f7cdeec4
commit 4e567d0483
7 changed files with 136 additions and 30 deletions

View File

@ -10,7 +10,9 @@
#if defined(__linux__) && !defined(NO_FILESYSTEM)
#include "modules/battery.hpp"
#endif
#if defined(HAVE_CPU_LINUX) || defined(HAVE_CPU_BSD)
#include "modules/cpu.hpp"
#endif
#include "modules/idle_inhibitor.hpp"
#if defined(HAVE_MEMORY_LINUX) || defined(HAVE_MEMORY_BSD)
#include "modules/memory.hpp"

View File

@ -20,7 +20,6 @@ class Cpu : public ALabel {
auto update() -> void;
private:
static inline const std::string data_dir_ = "/proc/stat";
uint16_t getCpuLoad();
std::tuple<uint16_t, std::string> getCpuUsage();
std::vector<std::tuple<size_t, size_t>> parseCpuinfo();