#pragma once #include #include #include #include #include #include #include #include #include "ALabel.hpp" #include "util/sleeper_thread.hpp" namespace waybar::modules { class Cpu : public ALabel { public: Cpu(const std::string&, const Json::Value&); ~Cpu() = default; auto update() -> void; private: static inline const std::string data_dir_ = "/proc/stat"; uint16_t getCpuLoad(); std::tuple getCpuUsage(); std::vector> parseCpuinfo(); std::vector> prev_times_; waybar::util::SleeperThread thread_; }; } // namespace waybar::modules