mirror of
https://github.com/aristocratos/btop.git
synced 2024-09-30 07:01:35 +02:00
reduce diff with main branch
This commit is contained in:
parent
ca9cb48054
commit
70b47d2ca8
2
Makefile
2
Makefile
@ -81,7 +81,7 @@ OBJEXT := o
|
|||||||
#? Flags, Libraries and Includes
|
#? Flags, Libraries and Includes
|
||||||
override REQFLAGS := -std=c++20
|
override REQFLAGS := -std=c++20
|
||||||
WARNFLAGS := -Wall -Wextra -pedantic
|
WARNFLAGS := -Wall -Wextra -pedantic
|
||||||
OPTFLAGS := -O2 -ftree-loop-vectorize -flto=$(THREADS)
|
OPTFLAGS ?= -O2 -ftree-loop-vectorize -flto=$(THREADS)
|
||||||
LDCXXFLAGS := -pthread -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS -fexceptions $(ADDFLAGS)
|
LDCXXFLAGS := -pthread -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS -fexceptions $(ADDFLAGS)
|
||||||
override CXXFLAGS += $(REQFLAGS) $(LDCXXFLAGS) $(OPTFLAGS) $(WARNFLAGS)
|
override CXXFLAGS += $(REQFLAGS) $(LDCXXFLAGS) $(OPTFLAGS) $(WARNFLAGS)
|
||||||
override LDFLAGS += $(LDCXXFLAGS) $(OPTFLAGS) $(WARNFLAGS)
|
override LDFLAGS += $(LDCXXFLAGS) $(OPTFLAGS) $(WARNFLAGS)
|
||||||
|
@ -304,6 +304,7 @@ namespace Runner {
|
|||||||
string empty_bg;
|
string empty_bg;
|
||||||
bool pause_output = false;
|
bool pause_output = false;
|
||||||
sigset_t mask;
|
sigset_t mask;
|
||||||
|
|
||||||
pthread_t runner_id;
|
pthread_t runner_id;
|
||||||
pthread_mutex_t mtx;
|
pthread_mutex_t mtx;
|
||||||
const unordered_flat_map<string, uint_fast8_t> box_bits = {
|
const unordered_flat_map<string, uint_fast8_t> box_bits = {
|
||||||
|
@ -339,7 +339,6 @@ namespace Cpu {
|
|||||||
if (one_ps_descriptor) {
|
if (one_ps_descriptor) {
|
||||||
CFDictionaryRef one_ps = IOPSGetPowerSourceDescription(ps_info, CFArrayGetValueAtIndex(one_ps_descriptor, 0));
|
CFDictionaryRef one_ps = IOPSGetPowerSourceDescription(ps_info, CFArrayGetValueAtIndex(one_ps_descriptor, 0));
|
||||||
has_battery = true;
|
has_battery = true;
|
||||||
auto state = CFDictionaryGetValue(one_ps, CFSTR(kIOPSPowerSourceStateKey));
|
|
||||||
CFNumberRef remaining = (CFNumberRef)CFDictionaryGetValue(one_ps, CFSTR(kIOPSTimeToEmptyKey));
|
CFNumberRef remaining = (CFNumberRef)CFDictionaryGetValue(one_ps, CFSTR(kIOPSTimeToEmptyKey));
|
||||||
int32_t estimatedMinutesRemaining;
|
int32_t estimatedMinutesRemaining;
|
||||||
if (remaining) {
|
if (remaining) {
|
||||||
@ -905,6 +904,33 @@ namespace Proc {
|
|||||||
|
|
||||||
//* Get detailed info for selected process
|
//* Get detailed info for selected process
|
||||||
void _collect_details(const size_t pid, const uint64_t uptime, vector<proc_info> &procs) {
|
void _collect_details(const size_t pid, const uint64_t uptime, vector<proc_info> &procs) {
|
||||||
|
if (pid != detailed.last_pid) {
|
||||||
|
detailed = {};
|
||||||
|
detailed.last_pid = pid;
|
||||||
|
detailed.skip_smaps = not Config::getB("proc_info_smaps");
|
||||||
|
}
|
||||||
|
|
||||||
|
//? Copy proc_info for process from proc vector
|
||||||
|
auto p_info = rng::find(procs, pid, &proc_info::pid);
|
||||||
|
detailed.entry = *p_info;
|
||||||
|
|
||||||
|
//? Update cpu percent deque for process cpu graph
|
||||||
|
if (not Config::getB("proc_per_core")) detailed.entry.cpu_p *= Shared::coreCount;
|
||||||
|
detailed.cpu_percent.push_back(clamp((long long)round(detailed.entry.cpu_p), 0ll, 100ll));
|
||||||
|
while (cmp_greater(detailed.cpu_percent.size(), width)) detailed.cpu_percent.pop_front();
|
||||||
|
|
||||||
|
//? Process runtime
|
||||||
|
detailed.elapsed = sec_to_dhms(uptime - (detailed.entry.cpu_s / Shared::clkTck));
|
||||||
|
if (detailed.elapsed.size() > 8) detailed.elapsed.resize(detailed.elapsed.size() - 3);
|
||||||
|
|
||||||
|
//? Get parent process name
|
||||||
|
if (detailed.parent.empty()) {
|
||||||
|
auto p_entry = rng::find(procs, detailed.entry.ppid, &proc_info::pid);
|
||||||
|
if (p_entry != procs.end()) detailed.parent = p_entry->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
//? Expand process status from single char to explanative string
|
||||||
|
detailed.status = (proc_states.contains(detailed.entry.state)) ? proc_states.at(detailed.entry.state) : "Unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
//* Collects and sorts process information from /proc
|
//* Collects and sorts process information from /proc
|
||||||
|
Loading…
Reference in New Issue
Block a user