mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
3bac96945c
This reverts commit 82302e58f3b611f7ff6d686d1783b1c32914f7c9.
31 lines
748 B
C++
31 lines
748 B
C++
#pragma once
|
|
|
|
#include <fmt/format.h>
|
|
#include <sys/sysinfo.h>
|
|
#include <fstream>
|
|
#include <iostream>
|
|
#include <numeric>
|
|
#include <vector>
|
|
#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<uint16_t, std::string> getCpuUsage();
|
|
std::vector<std::tuple<size_t, size_t>> parseCpuinfo();
|
|
|
|
std::vector<std::tuple<size_t, size_t>> prev_times_;
|
|
waybar::util::SleeperThread thread_;
|
|
};
|
|
|
|
} // namespace waybar::modules
|