mirror of
https://github.com/aristocratos/btop.git
synced 2024-10-31 21:01:03 +01:00
Squashed commit of the following:
commit0267eba2bb
Merge:50bbab0
e81cf2b
Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Nov 15 21:43:18 2023 +0100 Merge pull request #659 from ivanp7/patch-1 Add alternative key codes for Delete, Insert, Home, End commit50bbab0512
Merge:9edbf27
5a14c7b
Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Nov 15 21:35:50 2023 +0100 Merge pull request #660 from stradicat/feature/elementarish Elementarish theme: color update according to Elementary palette commit5a14c7b6fa
Merge:979506f
71eb414
Author: Dennis Mayr <dmayr.dev@gmail.com> Date: Wed Nov 15 17:27:34 2023 -0300 Merge branch 'main' of https://github.com/stradicat/btop commit979506f18e
Author: Dennis Mayr <dmayr.dev@gmail.com> Date: Wed Nov 8 11:17:47 2023 -0300 Elementarish theme: color update according to Elementary palette commit71eb4142e8
Author: Dennis Mayr <dmayr.dev@gmail.com> Date: Wed Nov 8 11:17:47 2023 -0300 Elementarish theme: color update according to Elementary palette commite81cf2b7ff
Author: vân <3432246+ivanp7@users.noreply.github.com> Date: Tue Nov 7 15:12:27 2023 +0000 Add alternative key codes for Insert, Home, End commitf9452ff6d5
Author: vân <3432246+ivanp7@users.noreply.github.com> Date: Mon Nov 6 13:31:53 2023 +0000 Add alternative Delete key code Delete key not always produces ^[[3~, on some terminals (like st) it produces ^[[P. commit9edbf27f1b
Merge:2a864f6
ff1f51c
Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Oct 21 02:09:55 2023 +0200 Merge pull request #649 from nobounce/workflow-timeout Set FreeBSD workflow timeout commitff1f51ccbb
Author: Steffen Winter <steffen.winter@proton.me> Date: Wed Oct 18 22:26:36 2023 +0200 Set FreeBSD workflow timeout Recently the FreeBSD workflow has started to hang in a boot loop when the VM starts up. The issue is being tracked upstream but there is not response at the moment. To work around this set a timeout to not waste CI minutes. Other workflows might also want this change since they don't take 20 minutes anyway. commit2a864f6f2e
Merge:636eb25
b2bf8ef
Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Oct 7 10:40:54 2023 +0200 Merge pull request #643 from DecklynKern/main Fix scrollbar not clearing sometimes. commitb2bf8ef504
Author: DecklynKern <DecklynKern@gmail.com> Date: Fri Oct 6 17:33:38 2023 -0600 Fix scrollbar not clearing sometimes. commit636eb25f5e
Merge:260c0f6
b5ba2fc
Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Sep 30 19:51:03 2023 +0200 Merge pull request #623 from rahulaggarwal965/main Add keybind for toggling memory display mode in PROC box commitb5ba2fc963
Author: Rahul Aggarwal <rahulaggarwal965@gmail.com> Date: Wed Sep 20 22:55:56 2023 -0400 Add keybind for toggling memory display mode in PROC box commit260c0f6623
Merge:52bfff7
e6a06eb
Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Sep 30 18:56:25 2023 +0200 Merge pull request #635 from lvxnull/editorconfig Add hpp files to .editorconfig commite6a06eb729
Author: lvxnull <86745229+lvxnull@users.noreply.github.com> Date: Thu Sep 28 19:44:47 2023 +0200 Add hpp files to .editorconfig commit52bfff7ceb
Merge:1f72e56
19dbbe1
Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Sat Sep 30 18:55:08 2023 +0200 Merge pull request #636 from nobounce/performance-iili Minor string initialization improvement commit19dbbe1a17
Author: nobounce <steffen.winter@proton.me> Date: Fri Sep 29 12:20:59 2023 +0200 Minor string initialization improvement commit1f72e56c7d
Merge:278a0e6
cdcf8bc
Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Fri Sep 29 10:43:21 2023 +0200 Merge pull request #633 from crestfallnatwork/main [fix] Made disks statvfs logic asynchronous. commitcdcf8bc929
Author: crestfalln <guptahiman01@gmail.com> Date: Fri Sep 29 09:07:27 2023 +0530 fixed bug where updated disks stats overrided disk io data commit9b4e85f08d
Author: crestfalln <no-reply@crestfalln.com> Date: Thu Sep 28 04:57:05 2023 +0530 fixed bug where updated disks stats overrided disk io data commit889623874e
Author: crestfalln <no-reply@crestfalln.com> Date: Wed Sep 27 23:57:06 2023 +0530 made disks stat logic async commit278a0e6b17
Merge:d16adc9
e89519f
Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Thu Sep 28 18:32:09 2023 +0200 Merge pull request #630 from lvxnull/signal-list Fix signal list on non-linux/weird linux platforms commite89519fbb2
Author: lvxnull <86745229+lvxnull@users.noreply.github.com> Date: Sun Sep 24 21:44:38 2023 +0200 Fix signal list on non-linux/weird linux platforms commitd16adc9fd0
Merge:2c3ac48
f34b408
Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Thu Sep 28 18:20:42 2023 +0200 Merge pull request #618 from nobounce/aggregate-child-processes Add option to accumulate a child's resources in parent in tree-view commitf34b40892f
Author: nobounce <steffen.winter@proton.me> Date: Sun Sep 24 16:34:50 2023 +0200 Make process thread count better readable when wider than 5 digits commit6027cedd42
Author: nobounce <steffen.winter@proton.me> Date: Thu Sep 14 23:27:05 2023 +0200 Add option to accumulate a child's resources in parent in tree-view commit2c3ac4855d
Merge:f90dc37
5c6a281
Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Sep 13 21:14:56 2023 +0200 Merge pull request #589 from nobounce/cmake Add CMake support for Linux commitf90dc37c26
Merge:0cac861
68a49c1
Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Wed Sep 13 20:27:05 2023 +0200 Merge pull request #610 from SidVeld/feature/horizon-theme Horizon theme commit5c6a281002
Author: nobounce <steffen.winter@proton.me> Date: Tue Aug 29 20:39:00 2023 +0200 Add CMake support Linux is completly supported FreeBSD is not able to create a static executable for now. See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273398 MacOS was not tested commit68a49c10a6
Author: SidVeld <sidveld@gmail.com> Date: Wed Sep 6 18:03:31 2023 +0300 Add horizon theme commit0cac861910
Merge:31be436
f798acd
Author: Jakob P. Liljenberg <admin@qvantnet.com> Date: Tue Sep 5 19:27:38 2023 +0200 Merge pull request #609 from scorpion-26/byteconv Fix short conversion of 1000-1023 *iB commitf798acdaf7
Author: scorpion-26 <dev.scorpion26@gmail.com> Date: Tue Sep 5 18:00:47 2023 +0200 Fix short conversion of 1000-1023*iB floating_humanizer([1000-1024], true) with base 8 returns "2K", whereas it should return "1.0K" to align with other formats. The conversion is also broken for all other units(e.g. 1023M is also broken and returns "2G") commit31be4362ce
Author: aristocratos <gnmjpl@gmail.com> Date: Sun Aug 27 02:00:07 2023 +0200 FreeBSD Github action 13.1 -> 13.2 and static libgcc and libstdc++ commitfc523fd1d0
Author: aristocratos <gnmjpl@gmail.com> Date: Sun Aug 27 01:36:26 2023 +0200 Fix for FreeBSD github action not failing "correctly"...
This commit is contained in:
parent
b87772611c
commit
19bcff894b
@ -1,4 +1,4 @@
|
|||||||
[*.{cpp,h,sh,md,cfg,sample}]
|
[*.{cpp,h,hpp,sh,md,cfg,sample}]
|
||||||
indent_style = tab
|
indent_style = tab
|
||||||
indent_size = 4
|
indent_size = 4
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build-freebsd:
|
build-freebsd:
|
||||||
runs-on: macos-12
|
runs-on: macos-12
|
||||||
|
timeout-minutes: 20
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
@ -36,18 +37,19 @@ jobs:
|
|||||||
- name: Compile
|
- name: Compile
|
||||||
uses: vmactions/freebsd-vm@v0
|
uses: vmactions/freebsd-vm@v0
|
||||||
with:
|
with:
|
||||||
release: 13.1
|
release: 13.2
|
||||||
usesh: true
|
usesh: true
|
||||||
prepare: |
|
prepare: |
|
||||||
pkg install -y gmake gcc11 coreutils git
|
pkg install -y gmake gcc11 coreutils git
|
||||||
git config --global --add safe.directory /Users/runner/work/btop/btop
|
git config --global --add safe.directory /Users/runner/work/btop/btop
|
||||||
run: |
|
run: |
|
||||||
gmake
|
gmake STATIC=true STRIP=true
|
||||||
GIT_HASH=$(git rev-parse --short "$GITHUB_SHA")
|
GIT_HASH=$(git rev-parse --short "$GITHUB_SHA")
|
||||||
mv bin/btop bin/btop-$GIT_HASH
|
mv bin/btop bin/btop-$GIT_HASH
|
||||||
ls -alh bin
|
ls -alh bin
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: btop-x86_64-FreeBSD-13.1
|
name: btop-x86_64-FreeBSD-13.2
|
||||||
path: 'bin/*'
|
path: 'bin/*'
|
||||||
|
if-no-files-found: error
|
||||||
|
22
.gitignore
vendored
22
.gitignore
vendored
@ -54,9 +54,11 @@ btop
|
|||||||
# Optional libraries
|
# Optional libraries
|
||||||
lib/rocm_smi_lib
|
lib/rocm_smi_lib
|
||||||
|
|
||||||
|
# Optional libraries
|
||||||
|
lib/rocm_smi_lib
|
||||||
|
|
||||||
#do not ignore .github directory
|
# Don't ignore .github directory
|
||||||
!.github
|
!.github/
|
||||||
|
|
||||||
# Ignore files created by Qt Creator
|
# Ignore files created by Qt Creator
|
||||||
*.config
|
*.config
|
||||||
@ -67,3 +69,19 @@ lib/rocm_smi_lib
|
|||||||
*.cxxflags
|
*.cxxflags
|
||||||
*.files
|
*.files
|
||||||
*.includes
|
*.includes
|
||||||
|
|
||||||
|
# CMake
|
||||||
|
CMakeLists.txt.user
|
||||||
|
CMakeCache.txt
|
||||||
|
CMakeFiles
|
||||||
|
CMakeScripts
|
||||||
|
Testing
|
||||||
|
Makefile
|
||||||
|
cmake_install.cmake
|
||||||
|
install_manifest.txt
|
||||||
|
compile_commands.json
|
||||||
|
CTestTestfile.cmake
|
||||||
|
_deps
|
||||||
|
|
||||||
|
# CLion
|
||||||
|
cmake-build-*
|
||||||
|
167
CMakeLists.txt
Normal file
167
CMakeLists.txt
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
# CMake configuration for btop
|
||||||
|
#
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.12)
|
||||||
|
|
||||||
|
# Disable in-source builds since they would override the Makefile
|
||||||
|
if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
message(FATAL_ERROR "In-source builds are not allowed")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
project("btop"
|
||||||
|
VERSION 1.2.13
|
||||||
|
DESCRIPTION "A monitor of resources"
|
||||||
|
HOMEPAGE_URL "https://github.com/aristocratos/btop"
|
||||||
|
LANGUAGES CXX
|
||||||
|
)
|
||||||
|
|
||||||
|
# Make custom modules available
|
||||||
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
|
||||||
|
|
||||||
|
# When the build type is not set we can't fortify
|
||||||
|
if(NOT CMAKE_BUILD_TYPE)
|
||||||
|
set(CMAKE_BUILD_TYPE Release)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
|
set(CMAKE_COLOR_DIAGNOSTICS ON)
|
||||||
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
|
# Options
|
||||||
|
option(BTOP_STATIC "Link btop statically" OFF)
|
||||||
|
option(BTOP_LTO "Enable LTO" ON)
|
||||||
|
option(BTOP_USE_MOLD "Use mold to link btop" OFF)
|
||||||
|
option(BTOP_PEDANTIC "Enable a bunch of additional warnings" OFF)
|
||||||
|
option(BTOP_WERROR "Compile with warnings as errors" OFF)
|
||||||
|
|
||||||
|
if(BTOP_STATIC)
|
||||||
|
# Set this before calling find_package
|
||||||
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||||
|
find_package(devstat REQUIRED)
|
||||||
|
find_package(kvm REQUIRED)
|
||||||
|
if(BTOP_STATIC)
|
||||||
|
find_package(elf REQUIRED)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(CheckCXXCompilerFlag)
|
||||||
|
include(CheckIPOSupported)
|
||||||
|
|
||||||
|
add_executable(btop
|
||||||
|
src/btop.cpp
|
||||||
|
src/btop_config.cpp
|
||||||
|
src/btop_draw.cpp
|
||||||
|
src/btop_input.cpp
|
||||||
|
src/btop_menu.cpp
|
||||||
|
src/btop_shared.cpp
|
||||||
|
src/btop_theme.cpp
|
||||||
|
src/btop_tools.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
# NOTE: Checks can be simplified with CMake 3.25
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||||
|
target_sources(btop PRIVATE
|
||||||
|
src/osx/btop_collect.cpp
|
||||||
|
src/osx/sensors.cpp
|
||||||
|
src/osx/smc.cpp
|
||||||
|
)
|
||||||
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||||
|
target_sources(btop PRIVATE src/freebsd/btop_collect.cpp)
|
||||||
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
|
target_sources(btop PRIVATE src/linux/btop_collect.cpp)
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "${CMAKE_SYSTEM_NAME} is not supported")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Check for and enable LTO
|
||||||
|
check_ipo_supported(RESULT ipo_supported)
|
||||||
|
if(ipo_supported AND BTOP_LTO)
|
||||||
|
set_target_properties(btop PROPERTIES INTERPROCEDURAL_OPTIMIZATION ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# TODO: enable more warnings in coordination with upstream
|
||||||
|
target_compile_options(btop PRIVATE
|
||||||
|
-Wall -Wextra -Wpedantic
|
||||||
|
-ftree-vectorize -fstack-clash-protection
|
||||||
|
)
|
||||||
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
|
target_compile_options(btop PRIVATE
|
||||||
|
-Wheader-hygiene -Wgnu -Wthread-safety
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(BTOP_PEDANTIC)
|
||||||
|
target_compile_options(btop PRIVATE
|
||||||
|
-Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wunused
|
||||||
|
-Woverloaded-virtual -Wconversion -Wsign-conversion -Wdouble-promotion
|
||||||
|
-Wformat=2 -Wimplicit-fallthrough -Weffc++
|
||||||
|
)
|
||||||
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
|
target_compile_options(btop PRIVATE
|
||||||
|
-Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wnull-dereference
|
||||||
|
-Wuseless-cast
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(BTOP_WERROR)
|
||||||
|
target_compile_options(btop PRIVATE -Werror)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
check_cxx_compiler_flag(-fstack-protector CXX_HAS_FSTACK_PROTECTOR)
|
||||||
|
if(CXX_HAS_FSTACK_PROTECTOR)
|
||||||
|
target_compile_options(btop PRIVATE -fstack-protector)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
check_cxx_compiler_flag(-fcf-protection CXX_HAS_FCF_PROTECTION)
|
||||||
|
if(CXX_HAS_FCF_PROTECTION)
|
||||||
|
target_compile_options(btop PRIVATE -fcf-protection)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_compile_definitions(btop PRIVATE
|
||||||
|
_FILE_OFFSET_BITS=64
|
||||||
|
_GLIBCXX_ASSERTIONS _LIBCPP_ENABLE_ASSERTIONS=1
|
||||||
|
# Only has an effect with optimizations enabled
|
||||||
|
$<$<NOT:$<CONFIG:Debug>>:_FORTIFY_SOURCE=2>
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(btop SYSTEM PRIVATE include)
|
||||||
|
|
||||||
|
# mold
|
||||||
|
if(BTOP_USE_MOLD)
|
||||||
|
target_link_options(btop PRIVATE -fuse-ld=mold)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(BTOP_STATIC)
|
||||||
|
target_compile_definitions(btop PRIVATE STATIC_BUILD)
|
||||||
|
target_link_options(btop PRIVATE -static LINKER:--fatal-warnings)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Add libraries
|
||||||
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||||
|
find_package(Threads REQUIRED)
|
||||||
|
target_link_libraries(btop PRIVATE Threads::Threads)
|
||||||
|
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||||
|
target_link_libraries(btop PRIVATE $<LINK_LIBRARY:FRAMEWORK,CoreFoundation)
|
||||||
|
target_link_libraries(btop PRIVATE $<LINK_LIBRARY:FRAMEWORK,IOKit)
|
||||||
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||||
|
target_link_libraries(btop PRIVATE devstat::devstat kvm::kvm)
|
||||||
|
if(BTOP_STATIC)
|
||||||
|
target_link_libraries(btop PRIVATE elf::elf)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
install(TARGETS btop RUNTIME)
|
||||||
|
install(FILES "btop.desktop" DESTINATION "share/applications")
|
||||||
|
install(FILES "Img/icon.png" DESTINATION "share/icons/hicolor/48x48/apps" RENAME "btop.png")
|
||||||
|
install(FILES "Img/icon.svg" DESTINATION "share/icons/hicolor/scalable/apps" RENAME "btop.svg")
|
||||||
|
install(DIRECTORY "themes" DESTINATION "share/btop")
|
||||||
|
|
201
README.md
201
README.md
@ -310,7 +310,35 @@ Also needs a UTF8 locale and a font that covers:
|
|||||||
|
|
||||||
The makefile also needs GNU coreutils and `sed` (should already be installed on any modern distribution).
|
The makefile also needs GNU coreutils and `sed` (should already be installed on any modern distribution).
|
||||||
|
|
||||||
For a `cmake` based build alternative see the [fork](https://github.com/jan-guenter/btop/tree/main) by @jan-guenter
|
### GPU compatibility
|
||||||
|
|
||||||
|
Btop++ supports NVIDIA and AMD GPUs out of the box on Linux, provided you have the correct drivers and libraries.
|
||||||
|
|
||||||
|
Compatibility with Intel GPUs using generic DRM calls is planned, as is compatibility for FreeBSD and macOS.
|
||||||
|
|
||||||
|
* **NVIDIA**
|
||||||
|
|
||||||
|
You must use an official NVIDIA driver, both the closed-source and [open-source](https://github.com/NVIDIA/open-gpu-kernel-modules) 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**
|
||||||
|
|
||||||
|
AMDGPU data is queried using the [ROCm SMI](https://github.com/RadeonOpenCompute/rocm_smi_lib) library, which may or may not be packaged for your distribution. If your distribution doesn't provide a package, btop++ is statically linked to ROCm SMI with the `RSMI_STATIC=true` make flag.
|
||||||
|
|
||||||
|
This flag expects the ROCm SMI source code in `lib/rocm_smi_lib`, and compilation will fail if it's not there. The latest tested version is 5.6.x, which can be obtained with the following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/RadeonOpenCompute/rocm_smi_lib.git --depth 1 -b rocm-5.6.x lib/rocm_smi_lib
|
||||||
|
```
|
||||||
|
|
||||||
|
<details>
|
||||||
|
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
### With Make
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
|
||||||
1. **Install dependencies (example for Ubuntu 21.04 Hirsute)**
|
1. **Install dependencies (example for Ubuntu 21.04 Hirsute)**
|
||||||
|
|
||||||
@ -401,6 +429,79 @@ Also needs a UTF8 locale and a font that covers:
|
|||||||
make help
|
make help
|
||||||
```
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
### With CMake (Community maintained)
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
|
||||||
|
1. **Install build dependencies**
|
||||||
|
|
||||||
|
Requires Clang / GCC, CMake, Ninja and Git
|
||||||
|
|
||||||
|
For example, with Debian Bookworm:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt install cmake git g++ ninja-build
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Clone the repository**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/aristocratos/btop.git && cd btop
|
||||||
|
``````
|
||||||
|
|
||||||
|
3. **Compile**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Configure
|
||||||
|
cmake -B build -G Ninja
|
||||||
|
# Build
|
||||||
|
cmake --build build
|
||||||
|
```
|
||||||
|
|
||||||
|
This will automatically build a release version of btop.
|
||||||
|
|
||||||
|
Some useful options to pass to the configure step:
|
||||||
|
|
||||||
|
| Configure flag | Description |
|
||||||
|
|---------------------------------|-------------------------------------------------------------------------|
|
||||||
|
| `-DBTOP_STATIC=<ON\|OFF>` | Enables static linking (OFF by default) |
|
||||||
|
| `-DBTOP_LTO=<ON\|OFF>` | Enables link time optimization (ON 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_WERROR=<ON\|OFF>` | Compile with warnings as errors (OFF by default) |
|
||||||
|
| `-DCMAKE_INSTALL_PREFIX=<path>` | The installation prefix ('/usr/local' by default) |
|
||||||
|
|
||||||
|
To force a compiler, run `CXX=<compiler> cmake -B build -G Ninja`
|
||||||
|
|
||||||
|
4. **Install**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cmake --install build
|
||||||
|
```
|
||||||
|
|
||||||
|
May require root privileges
|
||||||
|
|
||||||
|
5. **Uninstall**
|
||||||
|
|
||||||
|
CMake doesn't generate an uninstall target by default. To remove installed files, run
|
||||||
|
```
|
||||||
|
cat build/install_manifest.txt | xargs rm -irv
|
||||||
|
```
|
||||||
|
|
||||||
|
6. **Cleanup build directory**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cmake --build build -t clean
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
## Compilation macOS OSX
|
## Compilation macOS OSX
|
||||||
|
|
||||||
Needs GCC 10 or higher, (GCC 11 or above strongly recommended for better CPU efficiency in the compiled binary).
|
Needs GCC 10 or higher, (GCC 11 or above strongly recommended for better CPU efficiency in the compiled binary).
|
||||||
@ -497,6 +598,14 @@ Also needs a UTF8 locale and a font that covers:
|
|||||||
|
|
||||||
Note that GNU make (`gmake`) is required to compile on FreeBSD.
|
Note that GNU make (`gmake`) is required to compile on FreeBSD.
|
||||||
|
|
||||||
|
<details>
|
||||||
|
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
### With gmake
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
|
||||||
1. **Install dependencies**
|
1. **Install dependencies**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@ -577,28 +686,98 @@ Also needs a UTF8 locale and a font that covers:
|
|||||||
gmake help
|
gmake help
|
||||||
```
|
```
|
||||||
|
|
||||||
## GPU compatibility
|
|
||||||
|
|
||||||
Btop++ supports NVIDIA and AMD GPUs out of the box on Linux, provided you have the correct drivers and libraries.
|
|
||||||
|
|
||||||
Compatibility with Intel GPUs using generic DRM calls is planned, as is compatibility for FreeBSD and macOS.
|
</details>
|
||||||
|
|
||||||
* **NVIDIA**
|
<details>
|
||||||
|
|
||||||
You must use an official NVIDIA driver, both the closed-source and [open-source](https://github.com/NVIDIA/open-gpu-kernel-modules) ones have been verified to work.
|
<summary>
|
||||||
|
|
||||||
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.
|
### With CMake (Community maintained)
|
||||||
|
|
||||||
* **AMD**
|
</summary>
|
||||||
|
|
||||||
AMDGPU data is queried using the [ROCm SMI](https://github.com/RadeonOpenCompute/rocm_smi_lib) library, which may or may not be packaged for your distribution. If your distribution doesn't provide a package, btop++ is statically linked to ROCm SMI with the `RSMI_STATIC=true` make flag.
|
1. **Install build dependencies**
|
||||||
|
|
||||||
This flag expects the ROCm SMI source code in `lib/rocm_smi_lib`, and compilation will fail if it's not there. The latest tested version is 5.6.x, which can be obtained with the following command:
|
Requires Clang / GCC, CMake, Ninja and Git
|
||||||
|
|
||||||
|
_**Note:** LLVM's libc++ shipped with FreeBSD 13 is too old and cannot compile btop._
|
||||||
|
|
||||||
|
FreeBSD 14 and later:
|
||||||
|
```bash
|
||||||
|
pkg install cmake ninja
|
||||||
|
```
|
||||||
|
|
||||||
|
FreeBSD 13:
|
||||||
|
```bash
|
||||||
|
pkg install cmake gcc13 ninja
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Clone the repository**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/RadeonOpenCompute/rocm_smi_lib.git --depth 1 -b rocm-5.6.x lib/rocm_smi_lib
|
git clone https://github.com/aristocratos/btop.git && cd btop
|
||||||
|
``````
|
||||||
|
|
||||||
|
3. **Compile**
|
||||||
|
|
||||||
|
FreeBSD 14 and later:
|
||||||
|
```bash
|
||||||
|
# Configure
|
||||||
|
cmake -B build -G Ninja
|
||||||
|
# Build
|
||||||
|
cmake --build build
|
||||||
```
|
```
|
||||||
|
|
||||||
|
FreeBSD 13:
|
||||||
|
```bash
|
||||||
|
# Configure
|
||||||
|
CXX=g++13 cmake -B build -G Ninja
|
||||||
|
# Build
|
||||||
|
cmake --build build
|
||||||
|
```
|
||||||
|
|
||||||
|
This will automatically build a release version of btop.
|
||||||
|
|
||||||
|
Some useful options to pass to the configure step:
|
||||||
|
|
||||||
|
| Configure flag | Description |
|
||||||
|
|---------------------------------|-------------------------------------------------------------------------|
|
||||||
|
| `-DBTOP_STATIC=<ON\|OFF>` | Enables static linking (OFF by default) |
|
||||||
|
| `-DBTOP_LTO=<ON\|OFF>` | Enables link time optimization (ON 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_WERROR=<ON\|OFF>` | Compile with warnings as errors (OFF by default) |
|
||||||
|
| `-DCMAKE_INSTALL_PREFIX=<path>` | The installation prefix ('/usr/local' by default) |
|
||||||
|
|
||||||
|
_**Note:** Static linking does not work with GCC._
|
||||||
|
|
||||||
|
To force a compiler, run `CXX=<compiler> cmake -B build -G Ninja`
|
||||||
|
|
||||||
|
4. **Install**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cmake --install build
|
||||||
|
```
|
||||||
|
|
||||||
|
May require root privileges
|
||||||
|
|
||||||
|
5. **Uninstall**
|
||||||
|
|
||||||
|
CMake doesn't generate an uninstall target by default. To remove installed files, run
|
||||||
|
```
|
||||||
|
cat build/install_manifest.txt | xargs rm -irv
|
||||||
|
```
|
||||||
|
|
||||||
|
6. **Cleanup build directory**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cmake --build build -t clean
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
## Installing the snap
|
## Installing the snap
|
||||||
[![btop](https://snapcraft.io/btop/badge.svg)](https://snapcraft.io/btop)
|
[![btop](https://snapcraft.io/btop/badge.svg)](https://snapcraft.io/btop)
|
||||||
|
|
||||||
|
23
cmake/Modules/Finddevstat.cmake
Normal file
23
cmake/Modules/Finddevstat.cmake
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
# Find devstat, the Device Statistics Library
|
||||||
|
#
|
||||||
|
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||||
|
find_path(devstat_INCLUDE_DIR NAMES devstat.h)
|
||||||
|
find_library(devstat_LIBRARY NAMES devstat)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(devstat REQUIRED_VARS devstat_LIBRARY devstat_INCLUDE_DIR)
|
||||||
|
|
||||||
|
if(devstat_FOUND AND NOT TARGET devstat::devstat)
|
||||||
|
add_library(devstat::devstat UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(devstat::devstat PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${devstat_LIBRARY}"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${devstat_INCLUDE_DIR}"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
mark_as_advanced(devstat_INCLUDE_DIR devstat_LIBRARY)
|
||||||
|
endif()
|
||||||
|
|
23
cmake/Modules/Findelf.cmake
Normal file
23
cmake/Modules/Findelf.cmake
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
# Find libelf, the ELF Access Library
|
||||||
|
#
|
||||||
|
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||||
|
find_path(elf_INCLUDE_DIR NAMES libelf.h)
|
||||||
|
find_library(elf_LIBRARY NAMES elf)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(elf REQUIRED_VARS elf_LIBRARY elf_INCLUDE_DIR)
|
||||||
|
|
||||||
|
if(elf_FOUND AND NOT TARGET elf::elf)
|
||||||
|
add_library(elf::elf UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(elf::elf PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${elf_LIBRARY}"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${elf_INCLUDE_DIR}"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
mark_as_advanced(elf_INCLUDE_DIR elf_LIBRARY)
|
||||||
|
endif()
|
||||||
|
|
23
cmake/Modules/Findkvm.cmake
Normal file
23
cmake/Modules/Findkvm.cmake
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
# Find libkvm, the Kernel Data Access Library
|
||||||
|
#
|
||||||
|
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||||
|
find_path(kvm_INCLUDE_DIR NAMES kvm.h)
|
||||||
|
find_library(kvm_LIBRARY NAMES kvm)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(kvm REQUIRED_VARS kvm_LIBRARY kvm_INCLUDE_DIR)
|
||||||
|
|
||||||
|
if(kvm_FOUND AND NOT TARGET kvm::kvm)
|
||||||
|
add_library(kvm::kvm UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(kvm::kvm PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${kvm_LIBRARY}"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${kvm_INCLUDE_DIR}"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
mark_as_advanced(kvm_INCLUDE_DIR kvm_LIBRARY)
|
||||||
|
endif()
|
||||||
|
|
@ -109,6 +109,8 @@ namespace Config {
|
|||||||
|
|
||||||
{"proc_filter_kernel", "#* (Linux) Filter processes tied to the Linux kernel(similar behavior to htop)."},
|
{"proc_filter_kernel", "#* (Linux) Filter processes tied to the Linux kernel(similar behavior to htop)."},
|
||||||
|
|
||||||
|
{"proc_aggregate", "#* In tree-view, always accumulate child process resources in the parent process."},
|
||||||
|
|
||||||
{"cpu_graph_upper", "#* Sets the CPU stat shown in upper half of the CPU graph, \"total\" is always available.\n"
|
{"cpu_graph_upper", "#* Sets the CPU stat shown in upper half of the CPU graph, \"total\" is always available.\n"
|
||||||
"#* Select from a list of detected attributes from the options menu."},
|
"#* Select from a list of detected attributes from the options menu."},
|
||||||
|
|
||||||
@ -296,6 +298,7 @@ namespace Config {
|
|||||||
{"lowcolor", false},
|
{"lowcolor", false},
|
||||||
{"show_detailed", false},
|
{"show_detailed", false},
|
||||||
{"proc_filtering", false},
|
{"proc_filtering", false},
|
||||||
|
{"proc_aggregate", false},
|
||||||
#ifdef GPU_SUPPORT
|
#ifdef GPU_SUPPORT
|
||||||
{"nvml_measure_pcie_speeds", true},
|
{"nvml_measure_pcie_speeds", true},
|
||||||
{"gpu_mirror_graph", true},
|
{"gpu_mirror_graph", true},
|
||||||
|
@ -1876,7 +1876,17 @@ namespace Proc {
|
|||||||
else mem_str.resize((mem_p < 10 or mem_p >= 100 ? 3 : 4));
|
else mem_str.resize((mem_p < 10 or mem_p >= 100 ? 3 : 4));
|
||||||
mem_str += '%';
|
mem_str += '%';
|
||||||
}
|
}
|
||||||
out += (thread_size > 0 ? t_color + rjust(to_string(min(p.threads, (size_t)9999)), thread_size) + ' ' + end : "" )
|
|
||||||
|
// Shorten process thread representation when larger than 5 digits: 10000 -> 10K ...
|
||||||
|
const std::string proc_threads_string = [&] {
|
||||||
|
if (p.threads > 9999) {
|
||||||
|
return std::to_string(p.threads / 1000) + 'K';
|
||||||
|
} else {
|
||||||
|
return std::to_string(p.threads);
|
||||||
|
}
|
||||||
|
}();
|
||||||
|
|
||||||
|
out += (thread_size > 0 ? t_color + rjust(proc_threads_string, thread_size) + ' ' + end : "" )
|
||||||
+ g_color + ljust((cmp_greater(p.user.size(), user_size) ? p.user.substr(0, user_size - 1) + '+' : p.user), user_size) + ' '
|
+ g_color + ljust((cmp_greater(p.user.size(), user_size) ? p.user.substr(0, user_size - 1) + '+' : p.user), user_size) + ' '
|
||||||
+ m_color + rjust(mem_str, 5) + end + ' '
|
+ m_color + rjust(mem_str, 5) + end + ' '
|
||||||
+ (is_selected ? "" : Theme::c("inactive_fg")) + (show_graphs ? graph_bg * 5: "")
|
+ (is_selected ? "" : Theme::c("inactive_fg")) + (show_graphs ? graph_bg * 5: "")
|
||||||
@ -1892,8 +1902,11 @@ namespace Proc {
|
|||||||
if (numpids > select_max) {
|
if (numpids > select_max) {
|
||||||
const int scroll_pos = clamp((int)round((double)start * select_max / (numpids - select_max)), 0, height - 5);
|
const int scroll_pos = clamp((int)round((double)start * select_max / (numpids - select_max)), 0, height - 5);
|
||||||
out += Mv::to(y + 1, x + width - 2) + Fx::b + Theme::c("main_fg") + Symbols::up
|
out += Mv::to(y + 1, x + width - 2) + Fx::b + Theme::c("main_fg") + Symbols::up
|
||||||
+ Mv::to(y + height - 2, x + width - 2) + Symbols::down
|
+ Mv::to(y + height - 2, x + width - 2) + Symbols::down;
|
||||||
+ Mv::to(y + 2 + scroll_pos, x + width - 2) + "█";
|
|
||||||
|
for (int i = y + 2; i < y + height - 2; i++) {
|
||||||
|
out += Mv::to(i, x + width - 2) + ((i == y + 2 + scroll_pos) ? "█" : " ");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//? Current selection and number of processes
|
//? Current selection and number of processes
|
||||||
|
@ -64,9 +64,13 @@ namespace Input {
|
|||||||
{"[C", "right"},
|
{"[C", "right"},
|
||||||
{"OC", "right"},
|
{"OC", "right"},
|
||||||
{"[2~", "insert"},
|
{"[2~", "insert"},
|
||||||
|
{"[4h", "insert"},
|
||||||
{"[3~", "delete"},
|
{"[3~", "delete"},
|
||||||
|
{"[P", "delete"},
|
||||||
{"[H", "home"},
|
{"[H", "home"},
|
||||||
|
{"[1~", "home"},
|
||||||
{"[F", "end"},
|
{"[F", "end"},
|
||||||
|
{"[4~", "end"},
|
||||||
{"[5~", "page_up"},
|
{"[5~", "page_up"},
|
||||||
{"[6~", "page_down"},
|
{"[6~", "page_down"},
|
||||||
{"\t", "tab"},
|
{"\t", "tab"},
|
||||||
@ -362,6 +366,9 @@ namespace Input {
|
|||||||
else if (key == "c")
|
else if (key == "c")
|
||||||
Config::flip("proc_per_core");
|
Config::flip("proc_per_core");
|
||||||
|
|
||||||
|
else if (key == "%")
|
||||||
|
Config::flip("proc_mem_bytes");
|
||||||
|
|
||||||
else if (key == "delete" and not Config::getS("proc_filter").empty())
|
else if (key == "delete" and not Config::getS("proc_filter").empty())
|
||||||
Config::set("proc_filter", ""s);
|
Config::set("proc_filter", ""s);
|
||||||
|
|
||||||
|
@ -54,15 +54,73 @@ namespace Menu {
|
|||||||
int signalKillRet{}; // defaults to 0
|
int signalKillRet{}; // defaults to 0
|
||||||
|
|
||||||
const array<string, 32> P_Signals = {
|
const array<string, 32> P_Signals = {
|
||||||
"0",
|
"0",
|
||||||
|
#ifdef __linux__
|
||||||
|
#if defined(__hppa__)
|
||||||
|
"SIGHUP", "SIGINT", "SIGQUIT", "SIGILL",
|
||||||
|
"SIGTRAP", "SIGABRT", "SIGSTKFLT", "SIGFPE",
|
||||||
|
"SIGKILL", "SIGBUS", "SIGSEGV", "SIGXCPU",
|
||||||
|
"SIGPIPE", "SIGALRM", "SIGTERM", "SIGUSR1",
|
||||||
|
"SIGUSR2", "SIGCHLD", "SIGPWR", "SIGVTALRM",
|
||||||
|
"SIGPROF", "SIGIO", "SIGWINCH", "SIGSTOP",
|
||||||
|
"SIGTSTP", "SIGCONT", "SIGTTIN", "SIGTTOU",
|
||||||
|
"SIGURG", "SIGXFSZ", "SIGSYS"
|
||||||
|
#elif defined(__mips__)
|
||||||
|
"SIGHUP", "SIGINT", "SIGQUIT", "SIGILL",
|
||||||
|
"SIGTRAP", "SIGABRT", "SIGEMT", "SIGFPE",
|
||||||
|
"SIGKILL", "SIGBUS", "SIGSEGV", "SIGSYS",
|
||||||
|
"SIGPIPE", "SIGALRM", "SIGTERM", "SIGUSR1",
|
||||||
|
"SIGUSR2", "SIGCHLD", "SIGPWR", "SIGWINCH",
|
||||||
|
"SIGURG", "SIGIO", "SIGSTOP", "SIGTSTP",
|
||||||
|
"SIGCONT", "SIGTTIN", "SIGTTOU", "SIGVTALRM",
|
||||||
|
"SIGPROF", "SIGXCPU", "SIGXFSZ"
|
||||||
|
#elif defined(__alpha__)
|
||||||
|
"SIGHUP", "SIGINT", "SIGQUIT", "SIGILL",
|
||||||
|
"SIGTRAP", "SIGABRT", "SIGEMT", "SIGFPE",
|
||||||
|
"SIGKILL", "SIGBUS", "SIGSEGV", "SIGSYS",
|
||||||
|
"SIGPIPE", "SIGALRM", "SIGTERM", "SIGURG",
|
||||||
|
"SIGSTOP", "SIGTSTP", "SIGCONT", "SIGCHLD",
|
||||||
|
"SIGTTIN", "SIGTTOU", "SIGIO", "SIGXCPU",
|
||||||
|
"SIGXFSZ", "SIGVTALRM", "SIGPROF", "SIGWINCH",
|
||||||
|
"SIGPWR", "SIGUSR1", "SIGUSR2"
|
||||||
|
#elif defined (__sparc__)
|
||||||
|
"SIGHUP", "SIGINT", "SIGQUIT", "SIGILL",
|
||||||
|
"SIGTRAP", "SIGABRT", "SIGEMT", "SIGFPE",
|
||||||
|
"SIGKILL", "SIGBUS", "SIGSEGV", "SIGSYS",
|
||||||
|
"SIGPIPE", "SIGALRM", "SIGTERM", "SIGURG",
|
||||||
|
"SIGSTOP", "SIGTSTP", "SIGCONT", "SIGCHLD",
|
||||||
|
"SIGTTIN", "SIGTTOU", "SIGIO", "SIGXCPU",
|
||||||
|
"SIGXFSZ", "SIGVTALRM", "SIGPROF", "SIGWINCH",
|
||||||
|
"SIGLOST", "SIGUSR1", "SIGUSR2"
|
||||||
|
#else
|
||||||
"SIGHUP", "SIGINT", "SIGQUIT", "SIGILL",
|
"SIGHUP", "SIGINT", "SIGQUIT", "SIGILL",
|
||||||
"SIGTRAP", "SIGABRT", "SIGBUS", "SIGFPE",
|
"SIGTRAP", "SIGABRT", "SIGBUS", "SIGFPE",
|
||||||
"SIGKILL", "SIGUSR1", "SIGSEGV", "SIGUSR2",
|
"SIGKILL", "SIGUSR1", "SIGSEGV", "SIGUSR2",
|
||||||
"SIGPIPE", "SIGALRM", "SIGTERM", "16", "SIGCHLD",
|
"SIGPIPE", "SIGALRM", "SIGTERM", "SIGSTKFLT",
|
||||||
"SIGCONT", "SIGSTOP", "SIGTSTP", "SIGTTIN",
|
"SIGCHLD", "SIGCONT", "SIGSTOP", "SIGTSTP",
|
||||||
"SIGTTOU", "SIGURG", "SIGXCPU", "SIGXFSZ",
|
"SIGTTIN", "SIGTTOU", "SIGURG", "SIGXCPU",
|
||||||
"SIGVTALRM", "SIGPROF", "SIGWINCH", "SIGIO",
|
"SIGXFSZ", "SIGVTALRM", "SIGPROF", "SIGWINCH",
|
||||||
"SIGPWR", "SIGSYS"
|
"SIGIO", "SIGPWR", "SIGSYS"
|
||||||
|
#endif
|
||||||
|
#elif defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__APPLE__)
|
||||||
|
"SIGHUP", "SIGINT", "SIGQUIT", "SIGILL",
|
||||||
|
"SIGTRAP", "SIGABRT", "SIGEMT", "SIGFPE",
|
||||||
|
"SIGKILL", "SIGBUS", "SIGSEGV", "SIGSYS",
|
||||||
|
"SIGPIPE", "SIGALRM", "SIGTERM", "SIGURG",
|
||||||
|
"SIGSTOP", "SIGTSTP", "SIGCONT", "SIGCHLD",
|
||||||
|
"SIGTTIN", "SIGTTOU", "SIGIO", "SIGXCPU",
|
||||||
|
"SIGXFSZ", "SIGVTALRM", "SIGPROF", "SIGWINCH",
|
||||||
|
"SIGINFO", "SIGUSR1", "SIGUSR2"
|
||||||
|
#else
|
||||||
|
"SIGHUP", "SIGINT", "SIGQUIT", "SIGILL",
|
||||||
|
"SIGTRAP", "SIGABRT", "7", "SIGFPE",
|
||||||
|
"SIGKILL", "10", "SIGSEGV", "12",
|
||||||
|
"SIGPIPE", "SIGALRM", "SIGTERM", "16",
|
||||||
|
"17", "18", "19", "20",
|
||||||
|
"21", "22", "23", "24",
|
||||||
|
"25", "26", "27", "28",
|
||||||
|
"29", "30", "31"
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
unordered_flat_map<string, Input::Mouse_loc> mouse_mappings;
|
unordered_flat_map<string, Input::Mouse_loc> mouse_mappings;
|
||||||
@ -138,6 +196,7 @@ namespace Menu {
|
|||||||
{"c", "Toggle per-core cpu usage of processes."},
|
{"c", "Toggle per-core cpu usage of processes."},
|
||||||
{"r", "Reverse sorting order in processes box."},
|
{"r", "Reverse sorting order in processes box."},
|
||||||
{"e", "Toggle processes tree view."},
|
{"e", "Toggle processes tree view."},
|
||||||
|
{"%", "Toggles memory display mode in processes box."},
|
||||||
{"Selected +, -", "Expand/collapse the selected process in tree view."},
|
{"Selected +, -", "Expand/collapse the selected process in tree view."},
|
||||||
{"Selected t", "Terminate selected process with SIGTERM - 15."},
|
{"Selected t", "Terminate selected process with SIGTERM - 15."},
|
||||||
{"Selected k", "Kill selected process with SIGKILL - 9."},
|
{"Selected k", "Kill selected process with SIGKILL - 9."},
|
||||||
@ -675,6 +734,11 @@ namespace Menu {
|
|||||||
"Set true to show processes grouped by",
|
"Set true to show processes grouped by",
|
||||||
"parents with lines drawn between parent",
|
"parents with lines drawn between parent",
|
||||||
"and child process."},
|
"and child process."},
|
||||||
|
{"proc_aggregate",
|
||||||
|
"Aggregate child's resources in parent.",
|
||||||
|
"",
|
||||||
|
"In tree-view, include all child resources",
|
||||||
|
"with the parent even while expanded."},
|
||||||
{"proc_colors",
|
{"proc_colors",
|
||||||
"Enable colors in process view.",
|
"Enable colors in process view.",
|
||||||
"",
|
"",
|
||||||
|
@ -18,6 +18,7 @@ tab-size = 4
|
|||||||
|
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
|
|
||||||
|
#include "btop_config.hpp"
|
||||||
#include "btop_shared.hpp"
|
#include "btop_shared.hpp"
|
||||||
#include "btop_tools.hpp"
|
#include "btop_tools.hpp"
|
||||||
|
|
||||||
@ -168,6 +169,12 @@ namespace Proc {
|
|||||||
filter_found++;
|
filter_found++;
|
||||||
p.filtered = true;
|
p.filtered = true;
|
||||||
}
|
}
|
||||||
|
else if (Config::getB("proc_aggregate")) {
|
||||||
|
cur_proc.cpu_p += p.cpu_p;
|
||||||
|
cur_proc.cpu_c += p.cpu_c;
|
||||||
|
cur_proc.mem += p.mem;
|
||||||
|
cur_proc.threads += p.threads;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (collapsed or filtering) {
|
if (collapsed or filtering) {
|
||||||
return;
|
return;
|
||||||
|
@ -455,7 +455,7 @@ namespace Tools {
|
|||||||
out = to_string((int)round(stod(out)));
|
out = to_string((int)round(stod(out)));
|
||||||
}
|
}
|
||||||
if (out.size() > 3) {
|
if (out.size() > 3) {
|
||||||
out = to_string((int)(out[0] - '0') + 1);
|
out = to_string((int)(out[0] - '0')) + ".0";
|
||||||
start++;
|
start++;
|
||||||
}
|
}
|
||||||
out.push_back(units[start][0]);
|
out.push_back(units[start][0]);
|
||||||
|
@ -29,6 +29,7 @@ tab-size = 4
|
|||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
#include <arpa/inet.h> // for inet_ntop()
|
#include <arpa/inet.h> // for inet_ntop()
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
#include <future>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
|
||||||
#if defined(RSMI_STATIC)
|
#if defined(RSMI_STATIC)
|
||||||
@ -53,12 +54,17 @@ using std::numeric_limits;
|
|||||||
using std::round;
|
using std::round;
|
||||||
using std::streamsize;
|
using std::streamsize;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
using std::future;
|
||||||
|
using std::async;
|
||||||
|
using std::pair;
|
||||||
|
|
||||||
|
|
||||||
namespace fs = std::filesystem;
|
namespace fs = std::filesystem;
|
||||||
namespace rng = std::ranges;
|
namespace rng = std::ranges;
|
||||||
|
|
||||||
using namespace Tools;
|
using namespace Tools;
|
||||||
using namespace std::literals; // for operator""s
|
using namespace std::literals; // for operator""s
|
||||||
|
using namespace std::chrono_literals;
|
||||||
//? --------------------------------------------------- FUNCTIONS -----------------------------------------------------
|
//? --------------------------------------------------- FUNCTIONS -----------------------------------------------------
|
||||||
|
|
||||||
namespace Cpu {
|
namespace Cpu {
|
||||||
@ -1607,6 +1613,7 @@ namespace Mem {
|
|||||||
auto only_physical = Config::getB("only_physical");
|
auto only_physical = Config::getB("only_physical");
|
||||||
auto zfs_hide_datasets = Config::getB("zfs_hide_datasets");
|
auto zfs_hide_datasets = Config::getB("zfs_hide_datasets");
|
||||||
auto& disks = mem.disks;
|
auto& disks = mem.disks;
|
||||||
|
static unordered_flat_map<string, future<pair<disk_info, int>>> disks_stats_promises;
|
||||||
ifstream diskread;
|
ifstream diskread;
|
||||||
|
|
||||||
vector<string> filter;
|
vector<string> filter;
|
||||||
@ -1746,31 +1753,47 @@ namespace Mem {
|
|||||||
diskread.close();
|
diskread.close();
|
||||||
|
|
||||||
//? Get disk/partition stats
|
//? Get disk/partition stats
|
||||||
bool new_ignored = false;
|
for (auto it = disks.begin(); it != disks.end(); ) {
|
||||||
for (auto& [mountpoint, disk] : disks) {
|
auto &[mountpoint, disk] = *it;
|
||||||
if (std::error_code ec; not fs::exists(mountpoint, ec) or v_contains(ignore_list, mountpoint)) continue;
|
if (v_contains(ignore_list, mountpoint)) {
|
||||||
struct statvfs vfs;
|
it = disks.erase(it);
|
||||||
if (statvfs(mountpoint.c_str(), &vfs) < 0) {
|
|
||||||
Logger::warning("Failed to get disk/partition stats for mount \""+ mountpoint + "\" with statvfs error code: " + to_string(errno) + ". Ignoring...");
|
|
||||||
ignore_list.push_back(mountpoint);
|
|
||||||
new_ignored = true;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
disk.total = vfs.f_blocks * vfs.f_frsize;
|
if(auto promises_it = disks_stats_promises.find(mountpoint); promises_it != disks_stats_promises.end()){
|
||||||
disk.free = (free_priv ? vfs.f_bfree : vfs.f_bavail) * vfs.f_frsize;
|
auto& promise = promises_it->second;
|
||||||
disk.used = disk.total - disk.free;
|
if(promise.valid() &&
|
||||||
disk.used_percent = round((double)disk.used * 100 / disk.total);
|
promise.wait_for(0s) == std::future_status::timeout) {
|
||||||
disk.free_percent = 100 - disk.used_percent;
|
++it;
|
||||||
}
|
continue;
|
||||||
|
}
|
||||||
//? Remove any problematic disks added to the ignore_list
|
auto promise_res = promises_it->second.get();
|
||||||
if (new_ignored) {
|
if(promise_res.second != -1){
|
||||||
for (auto it = disks.begin(); it != disks.end();) {
|
ignore_list.push_back(mountpoint);
|
||||||
if (v_contains(ignore_list, it->first))
|
Logger::warning("Failed to get disk/partition stats for mount \""+ mountpoint + "\" with statvfs error code: " + to_string(promise_res.second) + ". Ignoring...");
|
||||||
it = disks.erase(it);
|
it = disks.erase(it);
|
||||||
else
|
continue;
|
||||||
it++;
|
}
|
||||||
|
auto &updated_stats = promise_res.first;
|
||||||
|
disk.total = updated_stats.total;
|
||||||
|
disk.free = updated_stats.free;
|
||||||
|
disk.used = updated_stats.used;
|
||||||
|
disk.used_percent = updated_stats.used_percent;
|
||||||
|
disk.free_percent = updated_stats.free_percent;
|
||||||
}
|
}
|
||||||
|
disks_stats_promises[mountpoint] = async(std::launch::async, [mountpoint, &free_priv]() -> pair<disk_info, int> {
|
||||||
|
struct statvfs vfs;
|
||||||
|
disk_info disk;
|
||||||
|
if (statvfs(mountpoint.c_str(), &vfs) < 0) {
|
||||||
|
return pair{disk, errno};
|
||||||
|
}
|
||||||
|
disk.total = vfs.f_blocks * vfs.f_frsize;
|
||||||
|
disk.free = (free_priv ? vfs.f_bfree : vfs.f_bavail) * vfs.f_frsize;
|
||||||
|
disk.used = disk.total - disk.free;
|
||||||
|
disk.used_percent = round((double)disk.used * 100 / disk.total);
|
||||||
|
disk.free_percent = 100 - disk.used_percent;
|
||||||
|
return pair{disk, -1};
|
||||||
|
});
|
||||||
|
++it;
|
||||||
}
|
}
|
||||||
|
|
||||||
//? Setup disks order in UI and add swap if enabled
|
//? Setup disks order in UI and add swap if enabled
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# By: Dennis Mayr
|
# By: Dennis Mayr
|
||||||
|
|
||||||
# Main bg
|
# Main bg
|
||||||
theme[main_bg]="#2b2b2b"
|
theme[main_bg]="#333333"
|
||||||
|
|
||||||
# Main text color
|
# Main text color
|
||||||
theme[main_fg]="#eee8d5"
|
theme[main_fg]="#eee8d5"
|
||||||
@ -12,71 +12,71 @@ theme[main_fg]="#eee8d5"
|
|||||||
theme[title]="#eee8d5"
|
theme[title]="#eee8d5"
|
||||||
|
|
||||||
# Higlight color for keyboard shortcuts
|
# Higlight color for keyboard shortcuts
|
||||||
theme[hi_fg]="#dc322f"
|
theme[hi_fg]="#d1302c"
|
||||||
|
|
||||||
# Background color of selected item in processes box
|
# Background color of selected item in processes box
|
||||||
theme[selected_bg]="#268bd2"
|
theme[selected_bg]="#268ad0"
|
||||||
|
|
||||||
# Foreground color of selected item in processes box
|
# Foreground color of selected item in processes box
|
||||||
theme[selected_fg]="#eee8d5"
|
theme[selected_fg]="#eee8d5"
|
||||||
|
|
||||||
# Color of inactive/disabled text
|
# Color of inactive/disabled text
|
||||||
theme[inactive_fg]="#586e75"
|
theme[inactive_fg]="#657b83"
|
||||||
|
|
||||||
# Misc colors for processes box including mini cpu graphs, details memory graph and details status text
|
# Misc colors for processes box including mini cpu graphs, details memory graph and details status text
|
||||||
theme[proc_misc]="#268bd2"
|
theme[proc_misc]="#268ad0"
|
||||||
|
|
||||||
# Cpu box outline color
|
# Cpu box outline color
|
||||||
theme[cpu_box]="#586e75"
|
theme[cpu_box]="#657b83"
|
||||||
|
|
||||||
# Memory/disks box outline color
|
# Memory/disks box outline color
|
||||||
theme[mem_box]="#586e75"
|
theme[mem_box]="#657b83"
|
||||||
|
|
||||||
# Net up/down box outline color
|
# Net up/down box outline color
|
||||||
theme[net_box]="#586e75"
|
theme[net_box]="#657b83"
|
||||||
|
|
||||||
# Processes box outline color
|
# Processes box outline color
|
||||||
theme[proc_box]="#586e75"
|
theme[proc_box]="#657b83"
|
||||||
|
|
||||||
# Box divider line and small boxes line color
|
# Box divider line and small boxes line color
|
||||||
theme[div_line]="#586e75"
|
theme[div_line]="#657b83"
|
||||||
|
|
||||||
# Temperature graph colors
|
# Temperature graph colors
|
||||||
theme[temp_start]="#859900"
|
theme[temp_start]="#859900"
|
||||||
theme[temp_mid]="#b58901"
|
theme[temp_mid]="#b28602"
|
||||||
theme[temp_end]="#dc322f"
|
theme[temp_end]="#d1302c"
|
||||||
|
|
||||||
# CPU graph colors
|
# CPU graph colors
|
||||||
theme[cpu_start]="#859900"
|
theme[cpu_start]="#859900"
|
||||||
theme[cpu_mid]="#b58901"
|
theme[cpu_mid]="#b28602"
|
||||||
theme[cpu_end]="#dc322f"
|
theme[cpu_end]="#d1302c"
|
||||||
|
|
||||||
# Mem/Disk free meter
|
# Mem/Disk free meter
|
||||||
theme[free_start]="#268bd2"
|
theme[free_start]="#268ad0"
|
||||||
theme[free_mid]="#6c71c4"
|
theme[free_mid]="#6c71c4"
|
||||||
theme[free_end]="#2a9d95"
|
theme[free_end]="#2a9d95"
|
||||||
|
|
||||||
# Mem/Disk cached meter
|
# Mem/Disk cached meter
|
||||||
theme[cached_start]="#268bd2"
|
theme[cached_start]="#268ad0"
|
||||||
theme[cached_mid]="#6c71c4"
|
theme[cached_mid]="#6c71c4"
|
||||||
theme[cached_end]="#dc322f"
|
theme[cached_end]="#d1302c"
|
||||||
|
|
||||||
# Mem/Disk available meter
|
# Mem/Disk available meter
|
||||||
theme[available_start]="#268bd2"
|
theme[available_start]="#268ad0"
|
||||||
theme[available_mid]="#6c71c4"
|
theme[available_mid]="#6c71c4"
|
||||||
theme[available_end]="#dc322f"
|
theme[available_end]="#d1302c"
|
||||||
|
|
||||||
# Mem/Disk used meter
|
# Mem/Disk used meter
|
||||||
theme[used_start]="#859900"
|
theme[used_start]="#859900"
|
||||||
theme[used_mid]="#b58901"
|
theme[used_mid]="#b28602"
|
||||||
theme[used_end]="#dc322f"
|
theme[used_end]="#d1302c"
|
||||||
|
|
||||||
# Download graph colors
|
# Download graph colors
|
||||||
theme[download_start]="#268bd2"
|
theme[download_start]="#268ad0"
|
||||||
theme[download_mid]="#6c71c4"
|
theme[download_mid]="#6c71c4"
|
||||||
theme[download_end]="#dc322f"
|
theme[download_end]="#d1302c"
|
||||||
|
|
||||||
# Upload graph colors
|
# Upload graph colors
|
||||||
theme[upload_start]="#268bd2"
|
theme[upload_start]="#268ad0"
|
||||||
theme[upload_mid]="#6c71c4"
|
theme[upload_mid]="#6c71c4"
|
||||||
theme[upload_end]="#dc322f"
|
theme[upload_end]="#d1302c"
|
||||||
|
86
themes/horizon.theme
Normal file
86
themes/horizon.theme
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
# All graphs and meters can be gradients
|
||||||
|
# For single color graphs leave "mid" and "end" variable empty.
|
||||||
|
# Use "start" and "end" variables for two color gradient
|
||||||
|
# Use "start", "mid" and "end" for three color gradient
|
||||||
|
|
||||||
|
# Main background, empty for terminal default, need to be empty if you want transparent background
|
||||||
|
theme[main_bg]="#1C1E26"
|
||||||
|
|
||||||
|
# Main text color
|
||||||
|
theme[main_fg]="#f8f8f2"
|
||||||
|
|
||||||
|
# Title color for boxes
|
||||||
|
theme[title]="#f8f8f2"
|
||||||
|
|
||||||
|
# Highlight color for keyboard shortcuts
|
||||||
|
theme[hi_fg]="#B877DB"
|
||||||
|
|
||||||
|
# Background color of selected items
|
||||||
|
theme[selected_bg]="#282b37"
|
||||||
|
|
||||||
|
# Foreground color of selected items
|
||||||
|
theme[selected_fg]="#f8f8f2"
|
||||||
|
|
||||||
|
# Color of inactive/disabled text
|
||||||
|
theme[inactive_fg]="#272e33"
|
||||||
|
|
||||||
|
# Color of text appearing on top of graphs, i.e uptime and current network graph scaling
|
||||||
|
theme[graph_text]="#f8f8f2"
|
||||||
|
|
||||||
|
# Misc colors for processes box including mini cpu graphs, details memory graph and details status text
|
||||||
|
theme[proc_misc]="#27D796"
|
||||||
|
|
||||||
|
# Cpu box outline color
|
||||||
|
theme[cpu_box]="#B877DB"
|
||||||
|
|
||||||
|
# Memory/disks box outline color
|
||||||
|
theme[mem_box]="#27D796"
|
||||||
|
|
||||||
|
# Net up/down box outline color
|
||||||
|
theme[net_box]="#E95678"
|
||||||
|
|
||||||
|
# Processes box outline color
|
||||||
|
theme[proc_box]="#25B2BC"
|
||||||
|
|
||||||
|
# Box divider line and small boxes line color
|
||||||
|
theme[div_line]="#272e33"
|
||||||
|
|
||||||
|
# Temperature graph colors
|
||||||
|
theme[temp_start]="#27D796"
|
||||||
|
theme[temp_mid]="#FAC29A"
|
||||||
|
theme[temp_end]="#E95678"
|
||||||
|
|
||||||
|
# CPU graph colors
|
||||||
|
theme[cpu_start]="#27D796"
|
||||||
|
theme[cpu_mid]="#FAC29A"
|
||||||
|
theme[cpu_end]="#E95678"
|
||||||
|
|
||||||
|
# Mem/Disk free meter
|
||||||
|
theme[free_start]="#E95678"
|
||||||
|
theme[free_mid]="#FAC29A"
|
||||||
|
theme[free_end]="#27D796"
|
||||||
|
|
||||||
|
# Mem/Disk cached meter
|
||||||
|
theme[cached_start]="#27D796"
|
||||||
|
theme[cached_mid]="#FAC29A"
|
||||||
|
theme[cached_end]="#E95678"
|
||||||
|
|
||||||
|
# Mem/Disk available meter
|
||||||
|
theme[available_start]="#27D796"
|
||||||
|
theme[available_mid]="#FAC29A"
|
||||||
|
theme[available_end]="#E95678"
|
||||||
|
|
||||||
|
# Mem/Disk used meter
|
||||||
|
theme[used_start]="#27D796"
|
||||||
|
theme[used_mid]="#FAC29A"
|
||||||
|
theme[used_end]="#E95678"
|
||||||
|
|
||||||
|
# Download graph colors
|
||||||
|
theme[download_start]="#27D796"
|
||||||
|
theme[download_mid]="#FAC29A"
|
||||||
|
theme[download_end]="#E95678"
|
||||||
|
|
||||||
|
# Upload graph colors
|
||||||
|
theme[upload_start]="#27D796"
|
||||||
|
theme[upload_mid]="#FAC29A"
|
||||||
|
theme[upload_end]="#E95678"
|
Loading…
Reference in New Issue
Block a user