mirror of
https://github.com/aristocratos/btop.git
synced 2024-06-02 02:24:54 +12:00
All but two places const bool
have been updated
I haven't touched `include/robin_hood.h` as I don't know whether it's a third-party header file that could get rewritten at a later time of a possible future release by the author(s) of it.
This commit is contained in:
parent
8331cb36f8
commit
f0e413ed6f
|
@ -604,7 +604,7 @@ namespace Runner {
|
|||
//? ------------------------------------------ Secondary thread end -----------------------------------------------
|
||||
|
||||
//* Runs collect and draw in a secondary thread, unlocks and locks config to update cached values
|
||||
void run(const string& box, const bool no_update, const bool force_redraw) {
|
||||
void run(const string& box, bool no_update, bool force_redraw) {
|
||||
atomic_wait_for(active, true, 5000);
|
||||
if (active) {
|
||||
Logger::error("Stall in Runner thread, restarting!");
|
||||
|
|
|
@ -343,7 +343,7 @@ namespace Draw {
|
|||
//* Meter class ------------------------------------------------------------------------------------------------------------>
|
||||
Meter::Meter() {}
|
||||
|
||||
Meter::Meter(const int width, const string& color_gradient, const bool invert)
|
||||
Meter::Meter(const int width, const string& color_gradient, bool invert)
|
||||
: width(width), color_gradient(color_gradient), invert(invert) {}
|
||||
|
||||
string Meter::operator()(int value) {
|
||||
|
@ -366,7 +366,7 @@ namespace Draw {
|
|||
|
||||
//* Graph class ------------------------------------------------------------------------------------------------------------>
|
||||
void Graph::_create(const deque<long long>& data, int data_offset) {
|
||||
const bool mult = (data.size() - data_offset > 1);
|
||||
bool mult = (data.size() - data_offset > 1);
|
||||
const auto& graph_symbol = Symbols::graph_symbols.at(symbol + '_' + (invert ? "down" : "up"));
|
||||
array<int, 2> result;
|
||||
const float mod = (height == 1) ? 0.3 : 0.1;
|
||||
|
@ -464,7 +464,7 @@ namespace Draw {
|
|||
this->_create(data, data_offset);
|
||||
}
|
||||
|
||||
string& Graph::operator()(const deque<long long>& data, const bool data_same) {
|
||||
string& Graph::operator()(const deque<long long>& data, bool data_same) {
|
||||
if (data_same) return out;
|
||||
|
||||
//? Make room for new characters on graph
|
||||
|
@ -503,7 +503,7 @@ namespace Cpu {
|
|||
vector<Draw::Graph> core_graphs;
|
||||
vector<Draw::Graph> temp_graphs;
|
||||
|
||||
string draw(const cpu_info& cpu, const bool force_redraw, const bool data_same) {
|
||||
string draw(const cpu_info& cpu, bool force_redraw, bool data_same) {
|
||||
if (Runner::stopping) return "";
|
||||
if (force_redraw) redraw = true;
|
||||
bool show_temps = (Config::getB("check_temp") and got_sensors);
|
||||
|
@ -725,7 +725,7 @@ namespace Mem {
|
|||
unordered_flat_map<string, Draw::Meter> disk_meters_free;
|
||||
unordered_flat_map<string, Draw::Graph> io_graphs;
|
||||
|
||||
string draw(const mem_info& mem, const bool force_redraw, const bool data_same) {
|
||||
string draw(const mem_info& mem, bool force_redraw, bool data_same) {
|
||||
if (Runner::stopping) return "";
|
||||
if (force_redraw) redraw = true;
|
||||
auto show_swap = Config::getB("show_swap");
|
||||
|
@ -884,7 +884,7 @@ namespace Mem {
|
|||
if (show_disks) {
|
||||
const auto& disks = mem.disks;
|
||||
cx = mem_width; cy = 0;
|
||||
const bool big_disk = disks_width >= 25;
|
||||
bool big_disk = disks_width >= 25;
|
||||
divider = Mv::l(1) + Theme::c("div_line") + Symbols::div_left + Symbols::h_line * disks_width + Theme::c("mem_box") + Fx::ub + Symbols::div_right + Mv::l(disks_width);
|
||||
const string hu_div = Theme::c("div_line") + Symbols::h_line + Theme::c("main_fg");
|
||||
if (io_mode) {
|
||||
|
@ -979,7 +979,7 @@ namespace Net {
|
|||
unordered_flat_map<string, Draw::Graph> graphs;
|
||||
string box;
|
||||
|
||||
string draw(const net_info& net, const bool force_redraw, const bool data_same) {
|
||||
string draw(const net_info& net, bool force_redraw, bool data_same) {
|
||||
if (Runner::stopping) return "";
|
||||
if (force_redraw) redraw = true;
|
||||
auto net_sync = Config::getB("net_sync");
|
||||
|
@ -1148,11 +1148,11 @@ namespace Proc {
|
|||
return (not changed ? -1 : selected);
|
||||
}
|
||||
|
||||
string draw(const vector<proc_info>& plist, const bool force_redraw, const bool data_same) {
|
||||
string draw(const vector<proc_info>& plist, bool force_redraw, bool data_same) {
|
||||
if (Runner::stopping) return "";
|
||||
auto proc_tree = Config::getB("proc_tree");
|
||||
const bool show_detailed = (Config::getB("show_detailed") and cmp_equal(Proc::detailed.last_pid, Config::getI("detailed_pid")));
|
||||
const bool proc_gradient = (Config::getB("proc_gradient") and not Config::getB("lowcolor") and Theme::gradients.contains("proc"));
|
||||
bool show_detailed = (Config::getB("show_detailed") and cmp_equal(Proc::detailed.last_pid, Config::getI("detailed_pid")));
|
||||
bool proc_gradient = (Config::getB("proc_gradient") and not Config::getB("lowcolor") and Theme::gradients.contains("proc"));
|
||||
auto proc_colors = Config::getB("proc_colors");
|
||||
auto tty_mode = Config::getB("tty_mode");
|
||||
auto& graph_symbol = (tty_mode ? "tty" : Config::getS("graph_symbol_proc"));
|
||||
|
@ -1194,7 +1194,7 @@ namespace Proc {
|
|||
|
||||
//? Detailed box
|
||||
if (show_detailed) {
|
||||
const bool alive = detailed.status != "Dead";
|
||||
bool alive = detailed.status != "Dead";
|
||||
dgraph_x = x;
|
||||
dgraph_width = max(width / 3, width - 121);
|
||||
d_width = width - dgraph_width - 1;
|
||||
|
@ -1347,7 +1347,7 @@ namespace Proc {
|
|||
|
||||
//? Draw details box if shown
|
||||
if (show_detailed) {
|
||||
const bool alive = detailed.status != "Dead";
|
||||
bool alive = detailed.status != "Dead";
|
||||
const int item_fit = floor((double)(d_width - 2) / 10);
|
||||
const int item_width = floor((double)(d_width - 2) / min(item_fit, 8));
|
||||
|
||||
|
@ -1406,7 +1406,7 @@ namespace Proc {
|
|||
}
|
||||
|
||||
//? Update graphs for processes with above 0.0% cpu usage, delete if below 0.1% 10x times
|
||||
const bool has_graph = show_graphs ? p_counters.contains(p.pid) : false;
|
||||
bool has_graph = show_graphs ? p_counters.contains(p.pid) : false;
|
||||
if (show_graphs and ((p.cpu_p > 0 and not has_graph) or (not data_same and has_graph))) {
|
||||
if (not has_graph) {
|
||||
p_graphs[p.pid] = Draw::Graph{5, 1, "", {}, graph_symbol};
|
||||
|
|
|
@ -93,7 +93,7 @@ namespace Draw {
|
|||
array<string, 101> cache;
|
||||
public:
|
||||
Meter();
|
||||
Meter(const int width, const string& color_gradient, const bool invert = false);
|
||||
Meter(const int width, const string& color_gradient, bool invert = false);
|
||||
|
||||
//* Return a string representation of the meter with given value
|
||||
string operator()(int value);
|
||||
|
@ -123,7 +123,7 @@ namespace Draw {
|
|||
long long max_value=0, long long offset=0);
|
||||
|
||||
//* Add last value from back of <data> and return string representation of graph
|
||||
string& operator()(const deque<long long>& data, const bool data_same=false);
|
||||
string& operator()(const deque<long long>& data, bool data_same=false);
|
||||
|
||||
//* Return string representation of graph
|
||||
string& operator()();
|
||||
|
|
|
@ -26,7 +26,7 @@ using namespace Tools;
|
|||
|
||||
|
||||
namespace Proc {
|
||||
void proc_sorter(vector<proc_info>& proc_vec, const string& sorting, const bool reverse, const bool tree) {
|
||||
void proc_sorter(vector<proc_info>& proc_vec, const string& sorting, bool reverse, bool tree) {
|
||||
if (reverse) {
|
||||
switch (v_index(sort_vector, sorting)) {
|
||||
case 0: rng::stable_sort(proc_vec, rng::less{}, &proc_info::pid); break;
|
||||
|
@ -70,7 +70,7 @@ namespace Proc {
|
|||
}
|
||||
}
|
||||
|
||||
void tree_sort(vector<tree_proc>& proc_vec, const string& sorting, const bool reverse, int& c_index, const int index_max, const bool collapsed) {
|
||||
void tree_sort(vector<tree_proc>& proc_vec, const string& sorting, bool reverse, int& c_index, const int index_max, bool collapsed) {
|
||||
if (proc_vec.size() > 1) {
|
||||
if (reverse) {
|
||||
switch (v_index(sort_vector, sorting)) {
|
||||
|
@ -99,7 +99,7 @@ namespace Proc {
|
|||
}
|
||||
|
||||
void _tree_gen(proc_info& cur_proc, vector<proc_info>& in_procs, vector<tree_proc>& out_procs,
|
||||
int cur_depth, const bool collapsed, const string& filter, bool found, const bool no_update, const bool should_filter) {
|
||||
int cur_depth, bool collapsed, const string& filter, bool found, bool no_update, bool should_filter) {
|
||||
auto cur_pos = out_procs.size();
|
||||
bool filtering = false;
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ namespace Runner {
|
|||
extern bool pause_output;
|
||||
extern string debug_bg;
|
||||
|
||||
void run(const string& box="", const bool no_update=false, const bool force_redraw=false);
|
||||
void run(const string& box="", bool no_update = false, bool force_redraw = false);
|
||||
void stop();
|
||||
|
||||
}
|
||||
|
@ -115,10 +115,10 @@ namespace Cpu {
|
|||
};
|
||||
|
||||
//* Collect cpu stats and temperatures
|
||||
auto collect(const bool no_update=false) -> cpu_info&;
|
||||
auto collect(bool no_update = false) -> cpu_info&;
|
||||
|
||||
//* Draw contents of cpu box using <cpu> as source
|
||||
string draw(const cpu_info& cpu, const bool force_redraw=false, const bool data_same=false);
|
||||
string draw(const cpu_info& cpu, bool force_redraw = false, bool data_same = false);
|
||||
|
||||
//* Parse /proc/cpu info for mapping of core ids
|
||||
auto get_core_mapping() -> unordered_flat_map<int, int>;
|
||||
|
@ -168,10 +168,10 @@ namespace Mem {
|
|||
uint64_t get_totalMem();
|
||||
|
||||
//* Collect mem & disks stats
|
||||
auto collect(const bool no_update=false) -> mem_info&;
|
||||
auto collect(bool no_update = false) -> mem_info&;
|
||||
|
||||
//* Draw contents of mem box using <mem> as source
|
||||
string draw(const mem_info& mem, const bool force_redraw=false, const bool data_same=false);
|
||||
string draw(const mem_info& mem, bool force_redraw = false, bool data_same = false);
|
||||
|
||||
}
|
||||
|
||||
|
@ -204,10 +204,10 @@ namespace Net {
|
|||
extern unordered_flat_map<string, net_info> current_net;
|
||||
|
||||
//* Collect net upload/download stats
|
||||
auto collect(const bool no_update=false) -> net_info&;
|
||||
auto collect(bool no_update=false) -> net_info&;
|
||||
|
||||
//* Draw contents of net box using <net> as source
|
||||
string draw(const net_info& net, const bool force_redraw=false, const bool data_same=false);
|
||||
string draw(const net_info& net, bool force_redraw = false, bool data_same = false);
|
||||
}
|
||||
|
||||
namespace Proc {
|
||||
|
@ -287,13 +287,13 @@ namespace Proc {
|
|||
extern detail_container detailed;
|
||||
|
||||
//* Collect and sort process information from /proc
|
||||
auto collect(const bool no_update=false) -> vector<proc_info>&;
|
||||
auto collect(bool no_update = false) -> vector<proc_info>&;
|
||||
|
||||
//* Update current selection and view, returns -1 if no change otherwise the current selection
|
||||
int selection(const string& cmd_key);
|
||||
|
||||
//* Draw contents of proc box using <plist> as data source
|
||||
string draw(const vector<proc_info>& plist, const bool force_redraw=false, const bool data_same=false);
|
||||
string draw(const vector<proc_info>& plist, bool force_redraw = false, bool data_same = false);
|
||||
|
||||
struct tree_proc {
|
||||
std::reference_wrapper<proc_info> entry;
|
||||
|
@ -301,15 +301,14 @@ namespace Proc {
|
|||
};
|
||||
|
||||
//* Sort vector of proc_info's
|
||||
void proc_sorter(vector<proc_info>& proc_vec, const string& sorting,
|
||||
const bool reverse, const bool tree = false);
|
||||
void proc_sorter(vector<proc_info>& proc_vec, const string& sorting, bool reverse, bool tree = false);
|
||||
|
||||
//* Recursive sort of process tree
|
||||
void tree_sort(vector<tree_proc>& proc_vec, const string& sorting,
|
||||
const bool reverse, int& c_index, const int index_max, const bool collapsed = false);
|
||||
bool reverse, int& c_index, const int index_max, bool collapsed = false);
|
||||
|
||||
//* Generate process tree list
|
||||
void _tree_gen(proc_info& cur_proc, vector<proc_info>& in_procs, vector<tree_proc>& out_procs,
|
||||
int cur_depth, const bool collapsed, const string& filter,
|
||||
bool found=false, const bool no_update=false, const bool should_filter=false);
|
||||
int cur_depth, bool collapsed, const string& filter,
|
||||
bool found = false, bool no_update = false, bool should_filter = false);
|
||||
}
|
||||
|
|
|
@ -98,10 +98,10 @@ namespace Term {
|
|||
}
|
||||
|
||||
auto get_min_size(const string& boxes) -> array<int, 2> {
|
||||
const bool cpu = boxes.find("cpu") != string::npos;
|
||||
const bool mem = boxes.find("mem") != string::npos;
|
||||
const bool net = boxes.find("net") != string::npos;
|
||||
const bool proc = boxes.find("proc") != string::npos;
|
||||
bool cpu = boxes.find("cpu") != string::npos;
|
||||
bool mem = boxes.find("mem") != string::npos;
|
||||
bool net = boxes.find("net") != string::npos;
|
||||
bool proc = boxes.find("proc") != string::npos;
|
||||
int width = 0;
|
||||
if (mem) width = Mem::min_width;
|
||||
else if (net) width = Mem::min_width;
|
||||
|
@ -205,8 +205,10 @@ namespace Tools {
|
|||
return chars;
|
||||
}
|
||||
|
||||
string uresize(string str, const size_t len, const bool wide) {
|
||||
if (len < 1 or str.empty()) return "";
|
||||
string uresize(string str, const size_t len, bool wide) {
|
||||
if (len < 1 or str.empty())
|
||||
return "";
|
||||
|
||||
if (wide) {
|
||||
try {
|
||||
std::wstring_convert<std::codecvt_utf8<wchar_t>> conv;
|
||||
|
@ -233,8 +235,10 @@ namespace Tools {
|
|||
return str;
|
||||
}
|
||||
|
||||
string luresize(string str, const size_t len, const bool wide) {
|
||||
if (len < 1 or str.empty()) return "";
|
||||
string luresize(string str, const size_t len, bool wide) {
|
||||
if (len < 1 or str.empty())
|
||||
return "";
|
||||
|
||||
for (size_t x = 0, last_pos = 0, i = str.size() - 1; i > 0 ; i--) {
|
||||
if (wide and static_cast<unsigned char>(str.at(i)) > 0xef) {
|
||||
x += 2;
|
||||
|
@ -484,7 +488,7 @@ namespace Tools {
|
|||
}
|
||||
|
||||
atomic_lock::atomic_lock(atomic<bool>& atom, bool wait) : atom(atom) {
|
||||
if (wait) while (not this->atom.compare_exchange_strong(this->not_true, true));
|
||||
if (wait) while (not this->atom.compare_exchange_strong(this->not_true, true));
|
||||
else this->atom.store(true);
|
||||
}
|
||||
|
||||
|
@ -546,10 +550,14 @@ namespace Logger {
|
|||
int status = -1;
|
||||
public:
|
||||
lose_priv() {
|
||||
if (geteuid() != Global::real_uid) this->status = seteuid(Global::real_uid);
|
||||
if (geteuid() != Global::real_uid) {
|
||||
this->status = seteuid(Global::real_uid);
|
||||
}
|
||||
}
|
||||
~lose_priv() {
|
||||
if (status == 0) status = seteuid(Global::set_uid);
|
||||
if (status == 0) {
|
||||
status = seteuid(Global::set_uid);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -566,8 +574,12 @@ namespace Logger {
|
|||
if (fs::exists(logfile) and fs::file_size(logfile, ec) > 1024 << 10 and not ec) {
|
||||
auto old_log = logfile;
|
||||
old_log += ".1";
|
||||
if (fs::exists(old_log)) fs::remove(old_log, ec);
|
||||
if (not ec) fs::rename(logfile, old_log, ec);
|
||||
|
||||
if (fs::exists(old_log))
|
||||
fs::remove(old_log, ec);
|
||||
|
||||
if (not ec)
|
||||
fs::rename(logfile, old_log, ec);
|
||||
}
|
||||
if (not ec) {
|
||||
std::ofstream lwrite(logfile, std::ios::app);
|
||||
|
|
|
@ -155,10 +155,10 @@ namespace Tools {
|
|||
}
|
||||
|
||||
//* Resize a string consisting of UTF8 characters (only reduces size)
|
||||
string uresize(const string str, const size_t len, const bool wide=false);
|
||||
string uresize(const string str, const size_t len, bool wide = false);
|
||||
|
||||
//* Resize a string consisting of UTF8 characters from left (only reduces size)
|
||||
string luresize(const string str, const size_t len, const bool wide=false);
|
||||
string luresize(const string str, const size_t len, bool wide = false);
|
||||
|
||||
//* Replace <from> in <str> with <to> and return new string
|
||||
string s_replace(const string& str, const string& from, const string& to);
|
||||
|
@ -288,7 +288,7 @@ namespace Tools {
|
|||
//* bit=True or defaults to bytes
|
||||
//* start=int to set 1024 multiplier starting unit
|
||||
//* short=True always returns 0 decimals and shortens unit to 1 character
|
||||
string floating_humanizer(uint64_t value, bool shorten = false, size_t start=0, bool bit = false, bool per_second = false);
|
||||
string floating_humanizer(uint64_t value, bool shorten = false, size_t start = 0, bool bit = false, bool per_second = false);
|
||||
|
||||
//* Add std::string operator * : Repeat string <str> <n> number of times
|
||||
std::string operator*(const string& str, int64_t n);
|
||||
|
|
|
@ -385,7 +385,7 @@ namespace Cpu {
|
|||
return {percent, seconds, status};
|
||||
}
|
||||
|
||||
auto collect(const bool no_update) -> cpu_info & {
|
||||
auto collect(bool no_update) -> cpu_info & {
|
||||
if (Runner::stopping or (no_update and not current_cpu.cpu_percent.at("total").empty()))
|
||||
return current_cpu;
|
||||
auto &cpu = current_cpu;
|
||||
|
@ -610,7 +610,7 @@ namespace Mem {
|
|||
|
||||
}
|
||||
|
||||
auto collect(const bool no_update) -> mem_info & {
|
||||
auto collect(bool no_update) -> mem_info & {
|
||||
if (Runner::stopping or (no_update and not current_mem.percent.at("used").empty()))
|
||||
return current_mem;
|
||||
|
||||
|
@ -618,7 +618,7 @@ namespace Mem {
|
|||
auto show_disks = Config::getB("show_disks");
|
||||
auto swap_disk = Config::getB("swap_disk");
|
||||
auto &mem = current_mem;
|
||||
static const bool snapped = (getenv("BTOP_SNAPPED") != NULL);
|
||||
static bool snapped = (getenv("BTOP_SNAPPED") != NULL);
|
||||
|
||||
int mib[4];
|
||||
u_int memActive, memWire, cachedMem, freeMem;
|
||||
|
@ -803,7 +803,7 @@ namespace Net {
|
|||
auto operator()() -> struct ifaddrs * { return ifaddr; }
|
||||
};
|
||||
|
||||
auto collect(const bool no_update) -> net_info & {
|
||||
auto collect(bool no_update) -> net_info & {
|
||||
auto &net = current_net;
|
||||
auto &config_iface = Config::getS("net_iface");
|
||||
auto net_sync = Config::getB("net_sync");
|
||||
|
@ -1078,7 +1078,7 @@ namespace Proc {
|
|||
};
|
||||
|
||||
//* Collects and sorts process information from /proc
|
||||
auto collect(const bool no_update) -> vector<proc_info> & {
|
||||
auto collect(bool no_update) -> vector<proc_info> & {
|
||||
const auto &sorting = Config::getS("proc_sorting");
|
||||
auto reverse = Config::getB("proc_reversed");
|
||||
const auto &filter = Config::getS("proc_filter");
|
||||
|
@ -1088,7 +1088,7 @@ namespace Proc {
|
|||
const size_t detailed_pid = Config::getI("detailed_pid");
|
||||
bool should_filter = current_filter != filter;
|
||||
if (should_filter) current_filter = filter;
|
||||
const bool sorted_change = (sorting != current_sort or reverse != current_rev or should_filter);
|
||||
bool sorted_change = (sorting != current_sort or reverse != current_rev or should_filter);
|
||||
if (sorted_change) {
|
||||
current_sort = sorting;
|
||||
current_rev = reverse;
|
||||
|
|
|
@ -659,7 +659,7 @@ namespace Cpu {
|
|||
return {percent, seconds, status};
|
||||
}
|
||||
|
||||
auto collect(const bool no_update) -> cpu_info& {
|
||||
auto collect(bool no_update) -> cpu_info& {
|
||||
if (Runner::stopping or (no_update and not current_cpu.cpu_percent.at("total").empty())) return current_cpu;
|
||||
auto& cpu = current_cpu;
|
||||
|
||||
|
@ -806,7 +806,7 @@ namespace Mem {
|
|||
return totalMem;
|
||||
}
|
||||
|
||||
auto collect(const bool no_update) -> mem_info& {
|
||||
auto collect(bool no_update) -> mem_info& {
|
||||
if (Runner::stopping or (no_update and not current_mem.percent.at("used").empty())) return current_mem;
|
||||
auto show_swap = Config::getB("show_swap");
|
||||
auto swap_disk = Config::getB("swap_disk");
|
||||
|
@ -1324,7 +1324,7 @@ namespace Net {
|
|||
auto operator()() -> struct ifaddrs* { return ifaddr; }
|
||||
};
|
||||
|
||||
auto collect(const bool no_update) -> net_info& {
|
||||
auto collect(bool no_update) -> net_info& {
|
||||
auto& net = current_net;
|
||||
auto& config_iface = Config::getS("net_iface");
|
||||
auto net_sync = Config::getB("net_sync");
|
||||
|
@ -1612,7 +1612,7 @@ namespace Proc {
|
|||
}
|
||||
|
||||
//* Collects and sorts process information from /proc
|
||||
auto collect(const bool no_update) -> vector<proc_info>& {
|
||||
auto collect(bool no_update) -> vector<proc_info>& {
|
||||
const auto& sorting = Config::getS("proc_sorting");
|
||||
auto reverse = Config::getB("proc_reversed");
|
||||
const auto& filter = Config::getS("proc_filter");
|
||||
|
@ -1623,7 +1623,7 @@ namespace Proc {
|
|||
const size_t detailed_pid = Config::getI("detailed_pid");
|
||||
bool should_filter = current_filter != filter;
|
||||
if (should_filter) current_filter = filter;
|
||||
const bool sorted_change = (sorting != current_sort or reverse != current_rev or should_filter);
|
||||
bool sorted_change = (sorting != current_sort or reverse != current_rev or should_filter);
|
||||
if (sorted_change) {
|
||||
current_sort = sorting;
|
||||
current_rev = reverse;
|
||||
|
|
|
@ -437,7 +437,7 @@ namespace Cpu {
|
|||
return {percent, seconds, status};
|
||||
}
|
||||
|
||||
auto collect(const bool no_update) -> cpu_info & {
|
||||
auto collect(bool no_update) -> cpu_info & {
|
||||
if (Runner::stopping or (no_update and not current_cpu.cpu_percent.at("total").empty()))
|
||||
return current_cpu;
|
||||
auto &cpu = current_cpu;
|
||||
|
@ -662,7 +662,7 @@ namespace Mem {
|
|||
}
|
||||
}
|
||||
|
||||
auto collect(const bool no_update) -> mem_info & {
|
||||
auto collect(bool no_update) -> mem_info & {
|
||||
if (Runner::stopping or (no_update and not current_mem.percent.at("used").empty()))
|
||||
return current_mem;
|
||||
|
||||
|
@ -670,7 +670,7 @@ namespace Mem {
|
|||
auto show_disks = Config::getB("show_disks");
|
||||
auto swap_disk = Config::getB("swap_disk");
|
||||
auto &mem = current_mem;
|
||||
static const bool snapped = (getenv("BTOP_SNAPPED") != NULL);
|
||||
static bool snapped = (getenv("BTOP_SNAPPED") != NULL);
|
||||
|
||||
vm_statistics64 p;
|
||||
mach_msg_type_number_t info_size = HOST_VM_INFO64_COUNT;
|
||||
|
@ -842,7 +842,7 @@ namespace Net {
|
|||
auto operator()() -> struct ifaddrs * { return ifaddr; }
|
||||
};
|
||||
|
||||
auto collect(const bool no_update) -> net_info & {
|
||||
auto collect(bool no_update) -> net_info & {
|
||||
auto &net = current_net;
|
||||
auto &config_iface = Config::getS("net_iface");
|
||||
auto net_sync = Config::getB("net_sync");
|
||||
|
@ -1106,7 +1106,7 @@ namespace Proc {
|
|||
}
|
||||
|
||||
//* Collects and sorts process information from /proc
|
||||
auto collect(const bool no_update) -> vector<proc_info> & {
|
||||
auto collect(bool no_update) -> vector<proc_info> & {
|
||||
const auto &sorting = Config::getS("proc_sorting");
|
||||
auto reverse = Config::getB("proc_reversed");
|
||||
const auto &filter = Config::getS("proc_filter");
|
||||
|
@ -1116,7 +1116,7 @@ namespace Proc {
|
|||
const size_t detailed_pid = Config::getI("detailed_pid");
|
||||
bool should_filter = current_filter != filter;
|
||||
if (should_filter) current_filter = filter;
|
||||
const bool sorted_change = (sorting != current_sort or reverse != current_rev or should_filter);
|
||||
bool sorted_change = (sorting != current_sort or reverse != current_rev or should_filter);
|
||||
if (sorted_change) {
|
||||
current_sort = sorting;
|
||||
current_rev = reverse;
|
||||
|
|
Loading…
Reference in a new issue