mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
feat(cpu): add both usage and load
This commit is contained in:
@ -1,9 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <sys/sysinfo.h>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <numeric>
|
||||
#include <iostream>
|
||||
#include "util/chrono.hpp"
|
||||
#include "ALabel.hpp"
|
||||
|
||||
@ -15,8 +17,11 @@ class Cpu : public ALabel {
|
||||
auto update() -> void;
|
||||
private:
|
||||
static inline const std::string data_dir_ = "/proc/stat";
|
||||
std::vector< std::tuple<size_t, size_t> > parseCpuinfo();
|
||||
std::vector< std::tuple<size_t, size_t> > prevTimes_;
|
||||
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_;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user