mirror of
https://github.com/aristocratos/btop.git
synced 2024-06-14 16:34:39 +12:00
Merge branch 'aristocratos:main' into battery-power-2
This commit is contained in:
commit
40cdb92b8e
14
CHANGELOG.md
14
CHANGELOG.md
|
@ -1,6 +1,8 @@
|
||||||
## v1.3.0
|
## v1.3.0
|
||||||
|
|
||||||
* Added Gpu Support | @romner-set | PR #529
|
* Added Gpu Support Linux | @romner-set | PR #529
|
||||||
|
|
||||||
|
* Added platform support for OpenBSD | @joske | PR #607
|
||||||
|
|
||||||
* Enable macos clang | @muneebmahmed | PR #666
|
* Enable macos clang | @muneebmahmed | PR #666
|
||||||
|
|
||||||
|
@ -42,6 +44,16 @@
|
||||||
|
|
||||||
* Create adwaita.theme | @flipflop133 | #485
|
* Create adwaita.theme | @flipflop133 | #485
|
||||||
|
|
||||||
|
* Try get terminal size of "/dev/tty" if stdout fails | @imwints | PR #627
|
||||||
|
|
||||||
|
* Refresh rate program argument | @imwints | PR #640
|
||||||
|
|
||||||
|
* Improved error handling when determining the config directory | @imwints | #652
|
||||||
|
|
||||||
|
* Use native POSIX polling syscalls to read input | @lvxnull | #624
|
||||||
|
|
||||||
|
* Conditional compile on Big Sur and up | @joske | PR #690
|
||||||
|
|
||||||
+ Various fixes by @imwints, @simplepad, @joske, @gwena, @cpalv, @iambeingtracked, @mattico, @NexAdn
|
+ Various fixes by @imwints, @simplepad, @joske, @gwena, @cpalv, @iambeingtracked, @mattico, @NexAdn
|
||||||
|
|
||||||
## v1.2.13
|
## v1.2.13
|
||||||
|
|
|
@ -11,7 +11,7 @@ if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
project("btop"
|
project("btop"
|
||||||
VERSION 1.2.13
|
VERSION 1.3.0
|
||||||
DESCRIPTION "A monitor of resources"
|
DESCRIPTION "A monitor of resources"
|
||||||
HOMEPAGE_URL "https://github.com/aristocratos/btop"
|
HOMEPAGE_URL "https://github.com/aristocratos/btop"
|
||||||
LANGUAGES CXX
|
LANGUAGES CXX
|
||||||
|
@ -41,6 +41,7 @@ option(BTOP_LTO "Enable LTO" ON)
|
||||||
option(BTOP_USE_MOLD "Use mold to link btop" OFF)
|
option(BTOP_USE_MOLD "Use mold to link btop" OFF)
|
||||||
option(BTOP_PEDANTIC "Enable a bunch of additional warnings" OFF)
|
option(BTOP_PEDANTIC "Enable a bunch of additional warnings" OFF)
|
||||||
option(BTOP_WERROR "Compile with warnings as errors" OFF)
|
option(BTOP_WERROR "Compile with warnings as errors" OFF)
|
||||||
|
option(BTOP_FORTIFY "Detect buffer overflows with _FORTIFY_SOURCE=3" ON)
|
||||||
option(BTOP_GPU "Enable GPU support" ON)
|
option(BTOP_GPU "Enable GPU support" ON)
|
||||||
cmake_dependent_option(BTOP_RSMI_STATIC "Link statically to ROCm SMI" OFF "BTOP_GPU" OFF)
|
cmake_dependent_option(BTOP_RSMI_STATIC "Link statically to ROCm SMI" OFF "BTOP_GPU" OFF)
|
||||||
|
|
||||||
|
@ -97,7 +98,7 @@ if(BTOP_WERROR)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT APPLE)
|
if(NOT APPLE)
|
||||||
target_compile_options(btop PRIVATE -fstack-clash-protection)
|
target_compile_options(btop PRIVATE -fstack-clash-protection)
|
||||||
endif()
|
endif()
|
||||||
check_cxx_compiler_flag(-fstack-protector HAS_FSTACK_PROTECTOR)
|
check_cxx_compiler_flag(-fstack-protector HAS_FSTACK_PROTECTOR)
|
||||||
if(HAS_FSTACK_PROTECTOR)
|
if(HAS_FSTACK_PROTECTOR)
|
||||||
|
@ -112,7 +113,7 @@ target_compile_definitions(btop PRIVATE
|
||||||
_FILE_OFFSET_BITS=64
|
_FILE_OFFSET_BITS=64
|
||||||
$<$<CONFIG:Debug>:_GLIBCXX_ASSERTIONS _LIBCPP_ENABLE_ASSERTIONS=1>
|
$<$<CONFIG:Debug>:_GLIBCXX_ASSERTIONS _LIBCPP_ENABLE_ASSERTIONS=1>
|
||||||
# Only has an effect with optimizations enabled
|
# Only has an effect with optimizations enabled
|
||||||
$<$<NOT:$<CONFIG:Debug>>:_FORTIFY_SOURCE=2>
|
$<$<AND:$<NOT:$<CONFIG:Debug>>,$<BOOL:${BTOP_FORTIFY}>>:_FORTIFY_SOURCE=3>
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(btop SYSTEM PRIVATE include)
|
target_include_directories(btop SYSTEM PRIVATE include)
|
||||||
|
|
7
Makefile
7
Makefile
|
@ -50,6 +50,11 @@ ifeq ($(GPU_SUPPORT),true)
|
||||||
override ADDFLAGS += -DGPU_SUPPORT
|
override ADDFLAGS += -DGPU_SUPPORT
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
FORTIFY_SOURCE ?= true
|
||||||
|
ifeq ($(FORTIFY_SOURCE),true)
|
||||||
|
override ADDFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3
|
||||||
|
endif
|
||||||
|
|
||||||
#? Compiler and Linker
|
#? Compiler and Linker
|
||||||
ifeq ($(shell $(CXX) --version | grep clang >/dev/null 2>&1; echo $$?),0)
|
ifeq ($(shell $(CXX) --version | grep clang >/dev/null 2>&1; echo $$?),0)
|
||||||
override CXX_IS_CLANG := true
|
override CXX_IS_CLANG := true
|
||||||
|
@ -174,7 +179,7 @@ override GOODFLAGS := $(foreach flag,$(TESTFLAGS),$(strip $(shell echo "int main
|
||||||
override REQFLAGS := -std=c++20
|
override REQFLAGS := -std=c++20
|
||||||
WARNFLAGS := -Wall -Wextra -pedantic
|
WARNFLAGS := -Wall -Wextra -pedantic
|
||||||
OPTFLAGS := -O2 -ftree-vectorize -flto=$(LTO)
|
OPTFLAGS := -O2 -ftree-vectorize -flto=$(LTO)
|
||||||
LDCXXFLAGS := -pthread -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS -D_FILE_OFFSET_BITS=64 $(GOODFLAGS) $(ADDFLAGS)
|
LDCXXFLAGS := -pthread -D_GLIBCXX_ASSERTIONS -D_FILE_OFFSET_BITS=64 $(GOODFLAGS) $(ADDFLAGS)
|
||||||
override CXXFLAGS += $(REQFLAGS) $(LDCXXFLAGS) $(OPTFLAGS) $(WARNFLAGS)
|
override CXXFLAGS += $(REQFLAGS) $(LDCXXFLAGS) $(OPTFLAGS) $(WARNFLAGS)
|
||||||
override LDFLAGS += $(LDCXXFLAGS) $(OPTFLAGS) $(WARNFLAGS)
|
override LDFLAGS += $(LDCXXFLAGS) $(OPTFLAGS) $(WARNFLAGS)
|
||||||
INC := $(foreach incdir,$(INCDIRS),-isystem $(incdir)) -I$(SRCDIR)
|
INC := $(foreach incdir,$(INCDIRS),-isystem $(incdir)) -I$(SRCDIR)
|
||||||
|
|
38
README.md
38
README.md
|
@ -43,6 +43,15 @@
|
||||||
|
|
||||||
## News
|
## News
|
||||||
|
|
||||||
|
##### 7 January 2024
|
||||||
|
|
||||||
|
Btop release v1.3.0
|
||||||
|
|
||||||
|
Big release with GPU support added for Linux and platform support for OpenBSD. Big thanks to [@romner-set](https://github.com/romner-set) (GPU support) and [@joske](https://github.com/joske) (OpenBSD support) for contributions.
|
||||||
|
And a multitude of bugfixes and small changes, see [CHANGELOG.md](CHANGELOG.md) and latest [release](https://github.com/aristocratos/btop/releases/latest) for detailed list and attributions.
|
||||||
|
|
||||||
|
See news entry below for more information regarding GPU support.
|
||||||
|
|
||||||
##### 25 November 2023
|
##### 25 November 2023
|
||||||
|
|
||||||
GPU monitoring added for Linux!
|
GPU monitoring added for Linux!
|
||||||
|
@ -69,6 +78,9 @@ Big update with version bump to 1.3 coming soon.
|
||||||
|
|
||||||
First release of btop4win available at https://github.com/aristocratos/btop4win
|
First release of btop4win available at https://github.com/aristocratos/btop4win
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>More...</summary>
|
||||||
|
|
||||||
##### 16 January 2022
|
##### 16 January 2022
|
||||||
|
|
||||||
Release v1.2.0 with FreeBSD support. No release binaries for FreeBSD provided as of yet.
|
Release v1.2.0 with FreeBSD support. No release binaries for FreeBSD provided as of yet.
|
||||||
|
@ -84,9 +96,6 @@ macOS binaries + installer are included for both x86 and ARM64 (Apple Silicon) i
|
||||||
|
|
||||||
Big thank you to [@joske](https://github.com/joske) who wrote the vast majority of the implementation!
|
Big thank you to [@joske](https://github.com/joske) who wrote the vast majority of the implementation!
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>More...</summary>
|
|
||||||
|
|
||||||
##### 30 October 2021
|
##### 30 October 2021
|
||||||
|
|
||||||
Work on the OSX [macOS] and FreeBSD branches, both initiated and mostly worked on by [@joske](https://github.com/joske), will likely be completed in the coming weeks.
|
Work on the OSX [macOS] and FreeBSD branches, both initiated and mostly worked on by [@joske](https://github.com/joske), will likely be completed in the coming weeks.
|
||||||
|
@ -213,6 +222,22 @@ Also needs a UTF8 locale and a font that covers:
|
||||||
* Unicode Block “Geometric Shapes” U+25A0 - U+25FF
|
* Unicode Block “Geometric Shapes” U+25A0 - U+25FF
|
||||||
* Unicode Block "Box Drawing" and "Block Elements" U+2500 - U+259F
|
* Unicode Block "Box Drawing" and "Block Elements" U+2500 - U+259F
|
||||||
|
|
||||||
|
### **Optional Dependencies (Needed for GPU monitoring)**
|
||||||
|
|
||||||
|
GPU monitoring also requires a btop binary built with GPU support (`GPU_SUPPORT=true` flag).
|
||||||
|
|
||||||
|
See [GPU compatibility](#gpu-compatibility) section for more about compiling with GPU support.
|
||||||
|
|
||||||
|
* **NVIDIA**
|
||||||
|
|
||||||
|
If you have an NVIDIA GPU you must use an official NVIDIA driver, both the closed-source and open-source ones have been verified to work.
|
||||||
|
|
||||||
|
In addition to that you must also have the nvidia-ml dynamic library installed, which should be included with the driver package of your distribution.
|
||||||
|
|
||||||
|
* **AMD**
|
||||||
|
|
||||||
|
If you have an AMD GPU `rocm_smi_lib` is required, which may or may not be packaged for your distribution.
|
||||||
|
|
||||||
### **Notice (Text rendering issues)**
|
### **Notice (Text rendering issues)**
|
||||||
|
|
||||||
* If you are having problems with the characters in the graphs not looking like they do in the screenshots, it's likely a problem with your systems configured fallback font not having support for braille characters.
|
* If you are having problems with the characters in the graphs not looking like they do in the screenshots, it's likely a problem with your systems configured fallback font not having support for braille characters.
|
||||||
|
@ -396,6 +421,7 @@ Also needs a UTF8 locale and a font that covers:
|
||||||
| `STRIP=true` | To force stripping of debug symbols (adds `-s` linker flag) |
|
| `STRIP=true` | To force stripping of debug symbols (adds `-s` linker flag) |
|
||||||
| `DEBUG=true` | Sets OPTFLAGS to `-O0 -g` and enables more verbose debug logging |
|
| `DEBUG=true` | Sets OPTFLAGS to `-O0 -g` and enables more verbose debug logging |
|
||||||
| `ARCH=<architecture>` | To manually set the target architecture |
|
| `ARCH=<architecture>` | To manually set the target architecture |
|
||||||
|
| `FORTIFY_SOURCE=false` | Disable fortification with `_FORTIFY_SOURCE=3` |
|
||||||
| `GPU_SUPPORT=<true\|false>` | Enable/disable GPU support (Enabled by default on X86_64 Linux) |
|
| `GPU_SUPPORT=<true\|false>` | Enable/disable GPU support (Enabled by default on X86_64 Linux) |
|
||||||
| `RSMI_STATIC=true` | To statically link the ROCm SMI library used for querying AMDGPU |
|
| `RSMI_STATIC=true` | To statically link the ROCm SMI library used for querying AMDGPU |
|
||||||
| `ADDFLAGS=<flags>` | For appending flags to both compiler and linker |
|
| `ADDFLAGS=<flags>` | For appending flags to both compiler and linker |
|
||||||
|
@ -494,6 +520,7 @@ Also needs a UTF8 locale and a font that covers:
|
||||||
| `-DBTOP_USE_MOLD=<ON\|OFF>` | Use mold to link btop (OFF by default) |
|
| `-DBTOP_USE_MOLD=<ON\|OFF>` | Use mold to link btop (OFF by default) |
|
||||||
| `-DBTOP_PEDANTIC=<ON\|OFF>` | Compile with additional warnings (OFF by default) |
|
| `-DBTOP_PEDANTIC=<ON\|OFF>` | Compile with additional warnings (OFF by default) |
|
||||||
| `-DBTOP_WERROR=<ON\|OFF>` | Compile with warnings as errors (OFF by default) |
|
| `-DBTOP_WERROR=<ON\|OFF>` | Compile with warnings as errors (OFF by default) |
|
||||||
|
| `-DBTOP_FORTIFY=<ON\|OFF>` | Detect buffer overflows with `_FORTIFY_SOURCE=3` (ON by default) |
|
||||||
| `-DBTOP_GPU=<ON\|OFF>` | Enable GPU support (ON by default) |
|
| `-DBTOP_GPU=<ON\|OFF>` | Enable GPU support (ON by default) |
|
||||||
| `-DBTOP_RSMI_STATIC=<ON\|OFF>` | Build and link the ROCm SMI library statically (OFF by default) |
|
| `-DBTOP_RSMI_STATIC=<ON\|OFF>` | Build and link the ROCm SMI library statically (OFF by default) |
|
||||||
| `-DCMAKE_INSTALL_PREFIX=<path>` | The installation prefix ('/usr/local' by default) |
|
| `-DCMAKE_INSTALL_PREFIX=<path>` | The installation prefix ('/usr/local' by default) |
|
||||||
|
@ -567,6 +594,7 @@ Also needs a UTF8 locale and a font that covers:
|
||||||
| `STRIP=true` | To force stripping of debug symbols (adds `-s` linker flag) |
|
| `STRIP=true` | To force stripping of debug symbols (adds `-s` linker flag) |
|
||||||
| `DEBUG=true` | Sets OPTFLAGS to `-O0 -g` and enables more verbose debug logging |
|
| `DEBUG=true` | Sets OPTFLAGS to `-O0 -g` and enables more verbose debug logging |
|
||||||
| `ARCH=<architecture>` | To manually set the target architecture |
|
| `ARCH=<architecture>` | To manually set the target architecture |
|
||||||
|
| `FORTIFY_SOURCE=false` | Disable fortification with `_FORTIFY_SOURCE=3` |
|
||||||
| `ADDFLAGS=<flags>` | For appending flags to both compiler and linker |
|
| `ADDFLAGS=<flags>` | For appending flags to both compiler and linker |
|
||||||
| `CXX=<compiler>` | Manualy set which compiler to use |
|
| `CXX=<compiler>` | Manualy set which compiler to use |
|
||||||
|
|
||||||
|
@ -665,6 +693,7 @@ Also needs a UTF8 locale and a font that covers:
|
||||||
| `-DBTOP_USE_MOLD=<ON\|OFF>` | Use mold to link btop (OFF by default) |
|
| `-DBTOP_USE_MOLD=<ON\|OFF>` | Use mold to link btop (OFF by default) |
|
||||||
| `-DBTOP_PEDANTIC=<ON\|OFF>` | Compile with additional warnings (OFF by default) |
|
| `-DBTOP_PEDANTIC=<ON\|OFF>` | Compile with additional warnings (OFF by default) |
|
||||||
| `-DBTOP_WERROR=<ON\|OFF>` | Compile with warnings as errors (OFF by default) |
|
| `-DBTOP_WERROR=<ON\|OFF>` | Compile with warnings as errors (OFF by default) |
|
||||||
|
| `-DBTOP_FORTIFY=<ON\|OFF>` | Detect buffer overflows with `_FORTIFY_SOURCE=3` (ON by default) |
|
||||||
| `-DCMAKE_INSTALL_PREFIX=<path>` | The installation prefix ('/usr/local' by default) |
|
| `-DCMAKE_INSTALL_PREFIX=<path>` | The installation prefix ('/usr/local' by default) |
|
||||||
|
|
||||||
To force any specific compiler, run `CXX=<compiler> cmake -B build -G Ninja`
|
To force any specific compiler, run `CXX=<compiler> cmake -B build -G Ninja`
|
||||||
|
@ -733,6 +762,7 @@ Also needs a UTF8 locale and a font that covers:
|
||||||
| `STRIP=true` | To force stripping of debug symbols (adds `-s` linker flag) |
|
| `STRIP=true` | To force stripping of debug symbols (adds `-s` linker flag) |
|
||||||
| `DEBUG=true` | Sets OPTFLAGS to `-O0 -g` and enables more verbose debug logging |
|
| `DEBUG=true` | Sets OPTFLAGS to `-O0 -g` and enables more verbose debug logging |
|
||||||
| `ARCH=<architecture>` | To manually set the target architecture |
|
| `ARCH=<architecture>` | To manually set the target architecture |
|
||||||
|
| `FORTIFY_SOURCE=false` | Disable fortification with `_FORTIFY_SOURCE=3` |
|
||||||
| `ADDFLAGS=<flags>` | For appending flags to both compiler and linker |
|
| `ADDFLAGS=<flags>` | For appending flags to both compiler and linker |
|
||||||
| `CXX=<compiler>` | Manualy set which compiler to use |
|
| `CXX=<compiler>` | Manualy set which compiler to use |
|
||||||
|
|
||||||
|
@ -842,6 +872,7 @@ Also needs a UTF8 locale and a font that covers:
|
||||||
| `-DBTOP_USE_MOLD=<ON\|OFF>` | Use mold to link btop (OFF by default) |
|
| `-DBTOP_USE_MOLD=<ON\|OFF>` | Use mold to link btop (OFF by default) |
|
||||||
| `-DBTOP_PEDANTIC=<ON\|OFF>` | Compile with additional warnings (OFF by default) |
|
| `-DBTOP_PEDANTIC=<ON\|OFF>` | Compile with additional warnings (OFF by default) |
|
||||||
| `-DBTOP_WERROR=<ON\|OFF>` | Compile with warnings as errors (OFF by default) |
|
| `-DBTOP_WERROR=<ON\|OFF>` | Compile with warnings as errors (OFF by default) |
|
||||||
|
| `-DBTOP_FORTIFY=<ON\|OFF>` | Detect buffer overflows with `_FORTIFY_SOURCE=3` (ON by default) |
|
||||||
| `-DCMAKE_INSTALL_PREFIX=<path>` | The installation prefix ('/usr/local' by default) |
|
| `-DCMAKE_INSTALL_PREFIX=<path>` | The installation prefix ('/usr/local' by default) |
|
||||||
|
|
||||||
_**Note:** Static linking does not work with GCC._
|
_**Note:** Static linking does not work with GCC._
|
||||||
|
@ -912,6 +943,7 @@ Also needs a UTF8 locale and a font that covers:
|
||||||
| `STRIP=true` | To force stripping of debug symbols (adds `-s` linker flag) |
|
| `STRIP=true` | To force stripping of debug symbols (adds `-s` linker flag) |
|
||||||
| `DEBUG=true` | Sets OPTFLAGS to `-O0 -g` and enables more verbose debug logging |
|
| `DEBUG=true` | Sets OPTFLAGS to `-O0 -g` and enables more verbose debug logging |
|
||||||
| `ARCH=<architecture>` | To manually set the target architecture |
|
| `ARCH=<architecture>` | To manually set the target architecture |
|
||||||
|
| `FORTIFY_SOURCE=false` | Disable fortification with `_FORTIFY_SOURCE=3` |
|
||||||
| `ADDFLAGS=<flags>` | For appending flags to both compiler and linker |
|
| `ADDFLAGS=<flags>` | For appending flags to both compiler and linker |
|
||||||
| `CXX=<compiler>` | Manualy set which compiler to use |
|
| `CXX=<compiler>` | Manualy set which compiler to use |
|
||||||
|
|
||||||
|
|
26
src/btop.cpp
26
src/btop.cpp
|
@ -96,9 +96,9 @@ namespace Global {
|
||||||
string exit_error_msg;
|
string exit_error_msg;
|
||||||
atomic<bool> thread_exception (false);
|
atomic<bool> thread_exception (false);
|
||||||
|
|
||||||
bool debuginit{}; // defaults to false
|
bool debuginit{};
|
||||||
bool debug{}; // defaults to false
|
bool debug{};
|
||||||
bool utf_force{}; // defaults to false
|
bool utf_force{};
|
||||||
|
|
||||||
uint64_t start_time;
|
uint64_t start_time;
|
||||||
|
|
||||||
|
@ -107,9 +107,10 @@ namespace Global {
|
||||||
atomic<bool> should_quit (false);
|
atomic<bool> should_quit (false);
|
||||||
atomic<bool> should_sleep (false);
|
atomic<bool> should_sleep (false);
|
||||||
atomic<bool> _runner_started (false);
|
atomic<bool> _runner_started (false);
|
||||||
|
atomic<bool> init_conf (false);
|
||||||
|
|
||||||
bool arg_tty{}; // defaults to false
|
bool arg_tty{};
|
||||||
bool arg_low_color{}; // defaults to false
|
bool arg_low_color{};
|
||||||
int arg_preset = -1;
|
int arg_preset = -1;
|
||||||
int arg_update = 0;
|
int arg_update = 0;
|
||||||
}
|
}
|
||||||
|
@ -418,7 +419,7 @@ namespace Runner {
|
||||||
|
|
||||||
string output;
|
string output;
|
||||||
string empty_bg;
|
string empty_bg;
|
||||||
bool pause_output{}; // defaults to false
|
bool pause_output{};
|
||||||
sigset_t mask;
|
sigset_t mask;
|
||||||
pthread_t runner_id;
|
pthread_t runner_id;
|
||||||
pthread_mutex_t mtx;
|
pthread_mutex_t mtx;
|
||||||
|
@ -894,10 +895,10 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//? Config init
|
//? Config init
|
||||||
{ vector<string> load_warnings;
|
{
|
||||||
|
atomic_lock lck(Global::init_conf);
|
||||||
|
vector<string> load_warnings;
|
||||||
Config::load(Config::conf_file, load_warnings);
|
Config::load(Config::conf_file, load_warnings);
|
||||||
|
|
||||||
if (Config::current_boxes.empty()) Config::check_boxes(Config::getS("shown_boxes"));
|
|
||||||
Config::set("lowcolor", (Global::arg_low_color ? true : not Config::getB("truecolor")));
|
Config::set("lowcolor", (Global::arg_low_color ? true : not Config::getB("truecolor")));
|
||||||
|
|
||||||
if (Global::debug) {
|
if (Global::debug) {
|
||||||
|
@ -918,7 +919,7 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
string found;
|
string found;
|
||||||
bool set_failure{}; // defaults to false
|
bool set_failure{};
|
||||||
for (const auto loc_env : array{"LANG", "LC_ALL"}) {
|
for (const auto loc_env : array{"LANG", "LC_ALL"}) {
|
||||||
if (std::getenv(loc_env) != nullptr and str_to_upper(s_replace((string)std::getenv(loc_env), "-", "")).ends_with("UTF8")) {
|
if (std::getenv(loc_env) != nullptr and str_to_upper(s_replace((string)std::getenv(loc_env), "-", "")).ends_with("UTF8")) {
|
||||||
found = std::getenv(loc_env);
|
found = std::getenv(loc_env);
|
||||||
|
@ -1018,6 +1019,11 @@ int main(int argc, char **argv) {
|
||||||
clean_quit(1);
|
clean_quit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (not Config::check_boxes(Config::getS("shown_boxes"))) {
|
||||||
|
Config::check_boxes("cpu mem net proc");
|
||||||
|
Config::set("shown_boxes", "cpu mem net proc"s);
|
||||||
|
}
|
||||||
|
|
||||||
//? Update list of available themes and generate the selected theme
|
//? Update list of available themes and generate the selected theme
|
||||||
Theme::updateThemes();
|
Theme::updateThemes();
|
||||||
Theme::setTheme();
|
Theme::setTheme();
|
||||||
|
|
|
@ -510,7 +510,7 @@ namespace Config {
|
||||||
else if (name.starts_with("graph_symbol_") and (value != "default" and not v_contains(valid_graph_symbols, value)))
|
else if (name.starts_with("graph_symbol_") and (value != "default" and not v_contains(valid_graph_symbols, value)))
|
||||||
validError = fmt::format("Invalid graph symbol identifier for {}: {}", name, value);
|
validError = fmt::format("Invalid graph symbol identifier for {}: {}", name, value);
|
||||||
|
|
||||||
else if (name == "shown_boxes" and not value.empty() and not check_boxes(value))
|
else if (name == "shown_boxes" and not Global::init_conf and not value.empty() and not check_boxes(value))
|
||||||
validError = "Invalid box name(s) in shown_boxes!";
|
validError = "Invalid box name(s) in shown_boxes!";
|
||||||
|
|
||||||
#ifdef GPU_SUPPORT
|
#ifdef GPU_SUPPORT
|
||||||
|
@ -622,8 +622,7 @@ namespace Config {
|
||||||
if (not v_contains(valid_boxes, box)) return false;
|
if (not v_contains(valid_boxes, box)) return false;
|
||||||
#ifdef GPU_SUPPORT
|
#ifdef GPU_SUPPORT
|
||||||
if (box.starts_with("gpu")) {
|
if (box.starts_with("gpu")) {
|
||||||
size_t gpu_num = stoi(box.substr(3));
|
size_t gpu_num = stoi(box.substr(3)) + 1;
|
||||||
if (gpu_num == 0) gpu_num = 5;
|
|
||||||
if (std::cmp_greater(gpu_num, Gpu::gpu_names.size())) return false;
|
if (std::cmp_greater(gpu_num, Gpu::gpu_names.size())) return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -307,8 +307,8 @@ namespace Draw {
|
||||||
{"/uptime", ""}
|
{"/uptime", ""}
|
||||||
};
|
};
|
||||||
|
|
||||||
static time_t c_time{}; // defaults to 0
|
static time_t c_time{};
|
||||||
static size_t clock_len{}; // defaults to 0
|
static size_t clock_len{};
|
||||||
static string clock_str;
|
static string clock_str;
|
||||||
|
|
||||||
if (auto n_time = time(nullptr); not force and n_time == c_time)
|
if (auto n_time = time(nullptr); not force and n_time == c_time)
|
||||||
|
@ -2013,7 +2013,7 @@ namespace Draw {
|
||||||
#ifdef GPU_SUPPORT
|
#ifdef GPU_SUPPORT
|
||||||
const bool show_gpu_on = Config::getS("show_gpu_info") == "On";
|
const bool show_gpu_on = Config::getS("show_gpu_info") == "On";
|
||||||
const bool gpus_shown_in_cpu_panel = Gpu::gpu_names.size() > 0 and (
|
const bool gpus_shown_in_cpu_panel = Gpu::gpu_names.size() > 0 and (
|
||||||
show_gpu_on or (Config::getS("cpu_graph_lower") == "Auto" and Gpu::shown == 0)
|
show_gpu_on or (Config::getS("show_gpu_info") == "Auto" and Gpu::shown == 0)
|
||||||
);
|
);
|
||||||
const int gpus_height_offset = (Gpu::gpu_names.size() - Gpu::shown)*gpus_shown_in_cpu_panel;
|
const int gpus_height_offset = (Gpu::gpu_names.size() - Gpu::shown)*gpus_shown_in_cpu_panel;
|
||||||
int gpus_extra_height = gpus_shown_in_cpu_panel ? Gpu::gpu_names.size() - (show_gpu_on ? 0 : Gpu::shown) : 0;
|
int gpus_extra_height = gpus_shown_in_cpu_panel ? Gpu::gpu_names.size() - (show_gpu_on ? 0 : Gpu::shown) : 0;
|
||||||
|
|
|
@ -65,8 +65,8 @@ namespace Draw {
|
||||||
|
|
||||||
//* An editable text field
|
//* An editable text field
|
||||||
class TextEdit {
|
class TextEdit {
|
||||||
size_t pos{}; // defaults to 0
|
size_t pos{};
|
||||||
size_t upos{}; // defaults to 0
|
size_t upos{};
|
||||||
bool numeric;
|
bool numeric;
|
||||||
public:
|
public:
|
||||||
string text;
|
string text;
|
||||||
|
|
|
@ -49,8 +49,8 @@ namespace Menu {
|
||||||
bool redraw{true};
|
bool redraw{true};
|
||||||
int currentMenu = -1;
|
int currentMenu = -1;
|
||||||
msgBox messageBox;
|
msgBox messageBox;
|
||||||
int signalToSend{}; // defaults to 0
|
int signalToSend{};
|
||||||
int signalKillRet{}; // defaults to 0
|
int signalKillRet{};
|
||||||
|
|
||||||
const array<string, 32> P_Signals = {
|
const array<string, 32> P_Signals = {
|
||||||
"0",
|
"0",
|
||||||
|
@ -873,8 +873,8 @@ namespace Menu {
|
||||||
|
|
||||||
int signalChoose(const string& key) {
|
int signalChoose(const string& key) {
|
||||||
auto s_pid = (Config::getB("show_detailed") and Config::getI("selected_pid") == 0 ? Config::getI("detailed_pid") : Config::getI("selected_pid"));
|
auto s_pid = (Config::getB("show_detailed") and Config::getI("selected_pid") == 0 ? Config::getI("detailed_pid") : Config::getI("selected_pid"));
|
||||||
static int x{}; // defaults to 0
|
static int x{};
|
||||||
static int y{}; // defaults to 0
|
static int y{};
|
||||||
static int selected_signal = -1;
|
static int selected_signal = -1;
|
||||||
|
|
||||||
if (bg.empty()) selected_signal = -1;
|
if (bg.empty()) selected_signal = -1;
|
||||||
|
@ -1075,8 +1075,8 @@ namespace Menu {
|
||||||
|
|
||||||
int mainMenu(const string& key) {
|
int mainMenu(const string& key) {
|
||||||
enum MenuItems { Options, Help, Quit };
|
enum MenuItems { Options, Help, Quit };
|
||||||
static int y{}; // defaults to 0
|
static int y{};
|
||||||
static int selected{}; // defaults to 0
|
static int selected{};
|
||||||
static vector<string> colors_selected;
|
static vector<string> colors_selected;
|
||||||
static vector<string> colors_normal;
|
static vector<string> colors_normal;
|
||||||
auto tty_mode = Config::getB("tty_mode");
|
auto tty_mode = Config::getB("tty_mode");
|
||||||
|
@ -1154,18 +1154,18 @@ namespace Menu {
|
||||||
|
|
||||||
int optionsMenu(const string& key) {
|
int optionsMenu(const string& key) {
|
||||||
enum Predispositions { isBool, isInt, isString, is2D, isBrowseable, isEditable};
|
enum Predispositions { isBool, isInt, isString, is2D, isBrowseable, isEditable};
|
||||||
static int y{}; // defaults to 0
|
static int y{};
|
||||||
static int x{}; // defaults to 0
|
static int x{};
|
||||||
static int height{}; // defaults to 0
|
static int height{};
|
||||||
static int page{}; // defaults to 0
|
static int page{};
|
||||||
static int pages{}; // defaults to 0
|
static int pages{};
|
||||||
static int selected{}; // defaults to 0
|
static int selected{};
|
||||||
static int select_max{}; // defaults to 0
|
static int select_max{};
|
||||||
static int item_height{}; // defaults to 0
|
static int item_height{};
|
||||||
static int selected_cat{}; // defaults to 0
|
static int selected_cat{};
|
||||||
static int max_items{}; // defaults to 0
|
static int max_items{};
|
||||||
static int last_sel{}; // defaults to 0
|
static int last_sel{};
|
||||||
static bool editing{}; // defaults to false
|
static bool editing{};
|
||||||
static Draw::TextEdit editor;
|
static Draw::TextEdit editor;
|
||||||
static string warnings;
|
static string warnings;
|
||||||
static bitset<8> selPred;
|
static bitset<8> selPred;
|
||||||
|
@ -1201,9 +1201,9 @@ namespace Menu {
|
||||||
Theme::updateThemes();
|
Theme::updateThemes();
|
||||||
}
|
}
|
||||||
int retval = Changed;
|
int retval = Changed;
|
||||||
bool recollect{}; // defaults to false
|
bool recollect{};
|
||||||
bool screen_redraw{}; // defaults to false
|
bool screen_redraw{};
|
||||||
bool theme_refresh{}; // defaults to false
|
bool theme_refresh{};
|
||||||
|
|
||||||
//? Draw background if needed else process input
|
//? Draw background if needed else process input
|
||||||
if (redraw) {
|
if (redraw) {
|
||||||
|
@ -1505,11 +1505,11 @@ namespace Menu {
|
||||||
}
|
}
|
||||||
|
|
||||||
int helpMenu(const string& key) {
|
int helpMenu(const string& key) {
|
||||||
static int y{}; // defaults to 0
|
static int y{};
|
||||||
static int x{}; // defaults to 0
|
static int x{};
|
||||||
static int height{}; // defaults to 0
|
static int height{};
|
||||||
static int page{}; // defaults to 0
|
static int page{};
|
||||||
static int pages{}; // defaults to 0
|
static int pages{};
|
||||||
|
|
||||||
if (bg.empty()) page = 0;
|
if (bg.empty()) page = 0;
|
||||||
int retval = Changed;
|
int retval = Changed;
|
||||||
|
|
|
@ -46,12 +46,12 @@ namespace Menu {
|
||||||
//? Strings in content vector is not checked for box width overflow
|
//? Strings in content vector is not checked for box width overflow
|
||||||
class msgBox {
|
class msgBox {
|
||||||
string box_contents, button_left, button_right;
|
string box_contents, button_left, button_right;
|
||||||
int height{}; // defaults to 0
|
int height{};
|
||||||
int width{}; // defaults to 0
|
int width{};
|
||||||
int boxtype{}; // defaults to 0
|
int boxtype{};
|
||||||
int selected{}; // defaults to 0
|
int selected{};
|
||||||
int x{}; // defaults to 0
|
int x{};
|
||||||
int y{}; // defaults to 0
|
int y{};
|
||||||
public:
|
public:
|
||||||
enum BoxTypes { OK, YES_NO, NO_YES };
|
enum BoxTypes { OK, YES_NO, NO_YES };
|
||||||
enum msgReturn {
|
enum msgReturn {
|
||||||
|
|
|
@ -54,6 +54,7 @@ namespace Global {
|
||||||
extern string overlay;
|
extern string overlay;
|
||||||
extern string clock;
|
extern string clock;
|
||||||
extern uid_t real_uid, set_uid;
|
extern uid_t real_uid, set_uid;
|
||||||
|
extern atomic<bool> init_conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Runner {
|
namespace Runner {
|
||||||
|
@ -228,11 +229,11 @@ namespace Mem {
|
||||||
string name;
|
string name;
|
||||||
string fstype{}; // defaults to ""
|
string fstype{}; // defaults to ""
|
||||||
std::filesystem::path stat{}; // defaults to ""
|
std::filesystem::path stat{}; // defaults to ""
|
||||||
int64_t total{}; // defaults to 0
|
int64_t total{};
|
||||||
int64_t used{}; // defaults to 0
|
int64_t used{};
|
||||||
int64_t free{}; // defaults to 0
|
int64_t free{};
|
||||||
int used_percent{}; // defaults to 0
|
int used_percent{};
|
||||||
int free_percent{}; // defaults to 0
|
int free_percent{};
|
||||||
|
|
||||||
array<int64_t, 3> old_io = {0, 0, 0};
|
array<int64_t, 3> old_io = {0, 0, 0};
|
||||||
deque<long long> io_read = {};
|
deque<long long> io_read = {};
|
||||||
|
@ -272,12 +273,12 @@ namespace Net {
|
||||||
extern std::unordered_map<string, uint64_t> graph_max;
|
extern std::unordered_map<string, uint64_t> graph_max;
|
||||||
|
|
||||||
struct net_stat {
|
struct net_stat {
|
||||||
uint64_t speed{}; // defaults to 0
|
uint64_t speed{};
|
||||||
uint64_t top{}; // defaults to 0
|
uint64_t top{};
|
||||||
uint64_t total{}; // defaults to 0
|
uint64_t total{};
|
||||||
uint64_t last{}; // defaults to 0
|
uint64_t last{};
|
||||||
uint64_t offset{}; // defaults to 0
|
uint64_t offset{};
|
||||||
uint64_t rollover{}; // defaults to 0
|
uint64_t rollover{};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct net_info {
|
struct net_info {
|
||||||
|
@ -285,7 +286,7 @@ namespace Net {
|
||||||
std::unordered_map<string, net_stat> stat = { {"download", {}}, {"upload", {}} };
|
std::unordered_map<string, net_stat> stat = { {"download", {}}, {"upload", {}} };
|
||||||
string ipv4{}; // defaults to ""
|
string ipv4{}; // defaults to ""
|
||||||
string ipv6{}; // defaults to ""
|
string ipv6{}; // defaults to ""
|
||||||
bool connected{}; // defaults to false
|
bool connected{};
|
||||||
};
|
};
|
||||||
|
|
||||||
extern std::unordered_map<string, net_info> current_net;
|
extern std::unordered_map<string, net_info> current_net;
|
||||||
|
@ -337,32 +338,32 @@ namespace Proc {
|
||||||
|
|
||||||
//* Container for process information
|
//* Container for process information
|
||||||
struct proc_info {
|
struct proc_info {
|
||||||
size_t pid{}; // defaults to 0
|
size_t pid{};
|
||||||
string name{}; // defaults to ""
|
string name{}; // defaults to ""
|
||||||
string cmd{}; // defaults to ""
|
string cmd{}; // defaults to ""
|
||||||
string short_cmd{}; // defaults to ""
|
string short_cmd{}; // defaults to ""
|
||||||
size_t threads{}; // defaults to 0
|
size_t threads{};
|
||||||
int name_offset{}; // defaults to 0
|
int name_offset{};
|
||||||
string user{}; // defaults to ""
|
string user{}; // defaults to ""
|
||||||
uint64_t mem{}; // defaults to 0
|
uint64_t mem{};
|
||||||
double cpu_p{}; // defaults to = 0.0
|
double cpu_p{}; // defaults to = 0.0
|
||||||
double cpu_c{}; // defaults to = 0.0
|
double cpu_c{}; // defaults to = 0.0
|
||||||
char state = '0';
|
char state = '0';
|
||||||
int64_t p_nice{}; // defaults to 0
|
int64_t p_nice{};
|
||||||
uint64_t ppid{}; // defaults to 0
|
uint64_t ppid{};
|
||||||
uint64_t cpu_s{}; // defaults to 0
|
uint64_t cpu_s{};
|
||||||
uint64_t cpu_t{}; // defaults to 0
|
uint64_t cpu_t{};
|
||||||
string prefix{}; // defaults to ""
|
string prefix{}; // defaults to ""
|
||||||
size_t depth{}; // defaults to 0
|
size_t depth{};
|
||||||
size_t tree_index{}; // defaults to 0
|
size_t tree_index{};
|
||||||
bool collapsed{}; // defaults to false
|
bool collapsed{};
|
||||||
bool filtered{}; // defaults to false
|
bool filtered{};
|
||||||
};
|
};
|
||||||
|
|
||||||
//* Container for process info box
|
//* Container for process info box
|
||||||
struct detail_container {
|
struct detail_container {
|
||||||
size_t last_pid{}; // defaults to 0
|
size_t last_pid{};
|
||||||
bool skip_smaps{}; // defaults to false
|
bool skip_smaps{};
|
||||||
proc_info entry;
|
proc_info entry;
|
||||||
string elapsed, parent, status, io_read, io_write, memory;
|
string elapsed, parent, status, io_read, io_write, memory;
|
||||||
long long first_mem = -1;
|
long long first_mem = -1;
|
||||||
|
|
|
@ -54,9 +54,9 @@ namespace rng = std::ranges;
|
||||||
//* Collection of escape codes and functions for terminal manipulation
|
//* Collection of escape codes and functions for terminal manipulation
|
||||||
namespace Term {
|
namespace Term {
|
||||||
|
|
||||||
atomic<bool> initialized{}; // defaults to false
|
atomic<bool> initialized{};
|
||||||
atomic<int> width{}; // defaults to 0
|
atomic<int> width{};
|
||||||
atomic<int> height{}; // defaults to 0
|
atomic<int> height{};
|
||||||
string current_tty;
|
string current_tty;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
|
@ -406,7 +406,7 @@ namespace Tools {
|
||||||
//* Sets atomic<bool> to true on construct, sets to false on destruct
|
//* Sets atomic<bool> to true on construct, sets to false on destruct
|
||||||
class atomic_lock {
|
class atomic_lock {
|
||||||
atomic<bool>& atom;
|
atomic<bool>& atom;
|
||||||
bool not_true{}; // defaults to false
|
bool not_true{};
|
||||||
public:
|
public:
|
||||||
atomic_lock(atomic<bool>& atom, bool wait = false);
|
atomic_lock(atomic<bool>& atom, bool wait = false);
|
||||||
~atomic_lock();
|
~atomic_lock();
|
||||||
|
|
|
@ -77,8 +77,8 @@ namespace Cpu {
|
||||||
vector<string> available_sensors = {"Auto"};
|
vector<string> available_sensors = {"Auto"};
|
||||||
cpu_info current_cpu;
|
cpu_info current_cpu;
|
||||||
fs::path freq_path = "/sys/devices/system/cpu/cpufreq/policy0/scaling_cur_freq";
|
fs::path freq_path = "/sys/devices/system/cpu/cpufreq/policy0/scaling_cur_freq";
|
||||||
bool got_sensors{}; // defaults to false
|
bool got_sensors{};
|
||||||
bool cpu_temp_only{}; // defaults to false
|
bool cpu_temp_only{};
|
||||||
|
|
||||||
//* Populate found_sensors map
|
//* Populate found_sensors map
|
||||||
bool get_sensors();
|
bool get_sensors();
|
||||||
|
@ -92,9 +92,9 @@ namespace Cpu {
|
||||||
struct Sensor {
|
struct Sensor {
|
||||||
fs::path path;
|
fs::path path;
|
||||||
string label;
|
string label;
|
||||||
int64_t temp{}; // defaults to 0
|
int64_t temp{};
|
||||||
int64_t high{}; // defaults to 0
|
int64_t high{};
|
||||||
int64_t crit{}; // defaults to 0
|
int64_t crit{};
|
||||||
};
|
};
|
||||||
|
|
||||||
std::unordered_map<string, Sensor> found_sensors;
|
std::unordered_map<string, Sensor> found_sensors;
|
||||||
|
@ -542,14 +542,14 @@ namespace Cpu {
|
||||||
}
|
}
|
||||||
|
|
||||||
string get_cpuHz() {
|
string get_cpuHz() {
|
||||||
static int failed{}; // defaults to 0
|
static int failed{};
|
||||||
|
|
||||||
if (failed > 4)
|
if (failed > 4)
|
||||||
return ""s;
|
return ""s;
|
||||||
|
|
||||||
string cpuhz;
|
string cpuhz;
|
||||||
try {
|
try {
|
||||||
double hz{}; // defaults to 0.0
|
double hz{};
|
||||||
//? Try to get freq from /sys/devices/system/cpu/cpufreq/policy first (faster)
|
//? Try to get freq from /sys/devices/system/cpu/cpufreq/policy first (faster)
|
||||||
if (not freq_path.empty()) {
|
if (not freq_path.empty()) {
|
||||||
hz = stod(readfile(freq_path, "0.0")) / 1000;
|
hz = stod(readfile(freq_path, "0.0")) / 1000;
|
||||||
|
@ -605,9 +605,9 @@ namespace Cpu {
|
||||||
//? Try to get core mapping from /proc/cpuinfo
|
//? Try to get core mapping from /proc/cpuinfo
|
||||||
ifstream cpuinfo(Shared::procPath / "cpuinfo");
|
ifstream cpuinfo(Shared::procPath / "cpuinfo");
|
||||||
if (cpuinfo.good()) {
|
if (cpuinfo.good()) {
|
||||||
int cpu{}; // defaults to 0
|
int cpu{};
|
||||||
int core{}; // defaults to 0
|
int core{};
|
||||||
int n{}; // defaults to 0
|
int n{};
|
||||||
for (string instr; cpuinfo >> instr;) {
|
for (string instr; cpuinfo >> instr;) {
|
||||||
if (instr == "processor") {
|
if (instr == "processor") {
|
||||||
cpuinfo.ignore(SSmax, ':');
|
cpuinfo.ignore(SSmax, ':');
|
||||||
|
@ -1554,10 +1554,10 @@ namespace Gpu {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace Mem {
|
namespace Mem {
|
||||||
bool has_swap{}; // defaults to false
|
bool has_swap{};
|
||||||
vector<string> fstab;
|
vector<string> fstab;
|
||||||
fs::file_time_type fstab_time;
|
fs::file_time_type fstab_time;
|
||||||
int disk_ios{}; // defaults to 0
|
int disk_ios{};
|
||||||
vector<string> last_found;
|
vector<string> last_found;
|
||||||
|
|
||||||
//?* Find the filepath to the specified ZFS object's stat file
|
//?* Find the filepath to the specified ZFS object's stat file
|
||||||
|
@ -2045,10 +2045,10 @@ namespace Mem {
|
||||||
int64_t bytes_read;
|
int64_t bytes_read;
|
||||||
int64_t bytes_write;
|
int64_t bytes_write;
|
||||||
int64_t io_ticks;
|
int64_t io_ticks;
|
||||||
int64_t bytes_read_total{}; // defaults to 0
|
int64_t bytes_read_total{};
|
||||||
int64_t bytes_write_total{}; // defaults to 0
|
int64_t bytes_write_total{};
|
||||||
int64_t io_ticks_total{}; // defaults to 0
|
int64_t io_ticks_total{};
|
||||||
int64_t objects_read{}; // defaults to 0
|
int64_t objects_read{};
|
||||||
|
|
||||||
// looking through all files that start with 'objset'
|
// looking through all files that start with 'objset'
|
||||||
for (const auto& file: fs::directory_iterator(disk.stat)) {
|
for (const auto& file: fs::directory_iterator(disk.stat)) {
|
||||||
|
@ -2124,11 +2124,11 @@ namespace Net {
|
||||||
net_info empty_net = {};
|
net_info empty_net = {};
|
||||||
vector<string> interfaces;
|
vector<string> interfaces;
|
||||||
string selected_iface;
|
string selected_iface;
|
||||||
int errors{}; // defaults to 0
|
int errors{};
|
||||||
std::unordered_map<string, uint64_t> graph_max = { {"download", {}}, {"upload", {}} };
|
std::unordered_map<string, uint64_t> graph_max = { {"download", {}}, {"upload", {}} };
|
||||||
std::unordered_map<string, array<int, 2>> max_count = { {"download", {}}, {"upload", {}} };
|
std::unordered_map<string, array<int, 2>> max_count = { {"download", {}}, {"upload", {}} };
|
||||||
bool rescale{true};
|
bool rescale{true};
|
||||||
uint64_t timestamp{}; // defaults to 0
|
uint64_t timestamp{};
|
||||||
|
|
||||||
//* RAII wrapper for getifaddrs
|
//* RAII wrapper for getifaddrs
|
||||||
class getifaddr_wrapper {
|
class getifaddr_wrapper {
|
||||||
|
@ -2217,7 +2217,7 @@ namespace Net {
|
||||||
auto& saved_stat = net.at(iface).stat.at(dir);
|
auto& saved_stat = net.at(iface).stat.at(dir);
|
||||||
auto& bandwidth = net.at(iface).bandwidth.at(dir);
|
auto& bandwidth = net.at(iface).bandwidth.at(dir);
|
||||||
|
|
||||||
uint64_t val{}; // defaults to 0
|
uint64_t val{};
|
||||||
try { val = (uint64_t)stoull(readfile(sys_file, "0")); }
|
try { val = (uint64_t)stoull(readfile(sys_file, "0")); }
|
||||||
catch (const std::invalid_argument&) {}
|
catch (const std::invalid_argument&) {}
|
||||||
catch (const std::out_of_range&) {}
|
catch (const std::out_of_range&) {}
|
||||||
|
@ -2337,15 +2337,15 @@ namespace Proc {
|
||||||
std::unordered_map<string, string> uid_user;
|
std::unordered_map<string, string> uid_user;
|
||||||
string current_sort;
|
string current_sort;
|
||||||
string current_filter;
|
string current_filter;
|
||||||
bool current_rev{}; // defaults to false
|
bool current_rev{};
|
||||||
|
|
||||||
fs::file_time_type passwd_time;
|
fs::file_time_type passwd_time;
|
||||||
|
|
||||||
uint64_t cputimes;
|
uint64_t cputimes;
|
||||||
int collapse = -1, expand = -1;
|
int collapse = -1, expand = -1;
|
||||||
uint64_t old_cputimes{}; // defaults to 0
|
uint64_t old_cputimes{};
|
||||||
atomic<int> numpids{}; // defaults to 0
|
atomic<int> numpids{};
|
||||||
int filter_found{}; // defaults to 0
|
int filter_found{};
|
||||||
|
|
||||||
detail_container detailed;
|
detail_container detailed;
|
||||||
constexpr size_t KTHREADD = 2;
|
constexpr size_t KTHREADD = 2;
|
||||||
|
@ -2477,7 +2477,7 @@ namespace Proc {
|
||||||
const int cmult = (per_core) ? Shared::coreCount : 1;
|
const int cmult = (per_core) ? Shared::coreCount : 1;
|
||||||
bool got_detailed = false;
|
bool got_detailed = false;
|
||||||
|
|
||||||
static size_t proc_clear_count{}; // defaults to 0
|
static size_t proc_clear_count{};
|
||||||
|
|
||||||
//* Use pids from last update if only changing filter, sorting or tree options
|
//* Use pids from last update if only changing filter, sorting or tree options
|
||||||
if (no_update and not current_procs.empty()) {
|
if (no_update and not current_procs.empty()) {
|
||||||
|
@ -2552,7 +2552,7 @@ namespace Proc {
|
||||||
|
|
||||||
//? Check if pid already exists in current_procs
|
//? Check if pid already exists in current_procs
|
||||||
auto find_old = rng::find(current_procs, pid, &proc_info::pid);
|
auto find_old = rng::find(current_procs, pid, &proc_info::pid);
|
||||||
bool no_cache{}; // defaults to false
|
bool no_cache{};
|
||||||
if (find_old == current_procs.end()) {
|
if (find_old == current_procs.end()) {
|
||||||
current_procs.push_back({pid});
|
current_procs.push_back({pid});
|
||||||
find_old = current_procs.end() - 1;
|
find_old = current_procs.end() - 1;
|
||||||
|
|
Loading…
Reference in a new issue