Commit Graph

679 Commits

Author SHA1 Message Date
aristocratos
0f398abd64 v1.4.4 Bug fixes 2025-07-03 22:53:42 +02:00
Rebecca Cran
dec33b445a Fix auto-detection of CPU temp on Ampere boards (#1185)
Ampere boards use the APM X-Gene Hardware Monitoring driver. The label
the driver returns is "Soc Temperature" which the current code doesn't
detect. Fix that by adding a special case for it. This prevents it from
using the "CPU Power" sensor and reporting the CPU tempature as over
8000C (which is the power reported in mW).

Co-authored-by: Rebecca Cran <rebecca@os.amperecomputing.com>
2025-07-02 09:48:28 +00:00
aristocratos
1c2ab3f5b5 Merge branch 'main' of github.com:aristocratos/btop 2025-06-14 18:36:43 +02:00
aristocratos
589c133fb3 Fixed floating_humanizer() to work correctly when numeric delimiter isn't a dot. 2025-06-14 18:36:39 +02:00
Steffen Winter
1b0b89212e Add command line option to set an inital filter
This will spawn btop with a filter already set, which can be edited and
also deleted as usual.

Beware that the filter will ALWAYS also match btop itself, since the
--filter argument on the command line will match.

Closes: https://github.com/aristocratos/btop/issues/883
2025-06-07 13:02:15 +00:00
Steffen Winter
27f11e4bc6 CMake: Create a library target for intel_gpu_top code
This allows the suppression of warnings specifically for the C code,
which throws lots of warnings with current compilers.
2025-06-03 08:57:17 +00:00
Steffen Winter
d429bcfe82 Exit gracefully if integer conversion in CLI parser fails 2025-06-01 22:35:38 +00:00
Steffen Winter
6d4bcacfee Make 100ms the minimal refresh rate
Closes: https://github.com/aristocratos/btop/issues/1171
2025-06-01 22:35:38 +00:00
MrCocoNuat
42fac76af9 Fix wrong use of too in terminal size error message (#1166) 2025-05-27 08:03:10 +00:00
Tim Strijdhorst
cfe075e649 Make the disk filter description more clear (#1077) 2025-05-23 21:57:56 +00:00
Jacek Wieczorek
a6ab8f6f97 Lock/unlock config to avoid infinite recursion (#1031)
Closes: #996
2025-05-23 12:34:04 +00:00
xDMPx
d758fc8dc6 Fix incorrect positioning and start symbol of second title introduced in 2538d89ed9 2025-05-12 22:33:32 +00:00
aristocratos
ffcd064a36 Fix dangling reference warnings for GCC 13 and later 2025-05-11 01:07:52 +02:00
aristocratos
3f1ccd9f6c v1.4.3 Bug fixes 2025-05-10 13:02:34 +02:00
Steffen Winter
d000384a41 Ignore incomplete filter regex
When a user enters a special regex character that expects a closing
character, btop will crash before the user has a chance to enter the
closing character. This will now just be ignored and no process will
match the filter until the regex is valid again.

Closes: https://github.com/aristocratos/btop/issues/1133
2025-05-03 12:59:36 +00:00
aristocratos
c3b225f536 Revert e266ccd which broke str_to_upper() and str_to_lower() 2025-05-03 13:25:46 +02:00
aristocratos
274d0c78e5 v1.4.2 Bug fixes 2025-05-01 22:24:11 +02:00
aristocratos
f1482fe87e Fix process arguments appearing outside proc box by replacing ASCII control codes with blankspace, issue #1080 2025-05-01 21:59:49 +02:00
Steffen Winter
2538d89ed9 perf: use string view everywhere
This has the potential to avoid allocations when something non allocated
is implicitly converted.
2025-05-01 20:36:27 +02:00
Steffen Winter
c52b2c4c93 perf: avoid copies by moving string into struct 2025-05-01 20:36:27 +02:00
Steffen Winter
99713316e8 perf: avoid copies with capture-by-reference 2025-05-01 20:36:27 +02:00
Steffen Winter
eb7970ad89 refactor: use algorithm from <ranges> 2025-05-01 20:36:27 +02:00
Steffen Winter
e266ccdc99 refactor: remove unnecessary lamda 2025-05-01 20:36:27 +02:00
Steffen Winter
c7e76900ff perf: use smaller enum base type 2025-05-01 20:36:27 +02:00
Tom Webber
fd35ac1b61 Update flags in help message and README
Co-authored-by: Steffen Winter <steffen.winter@proton.me>
2025-05-01 17:47:30 +00:00
Tom Webber
a5b01c1ac3 Fix wrong naming in documentation and error messages for force-utf argument 2025-05-01 17:47:30 +00:00
Steffen Winter
d3e16cb8e3 Respect the cli flags debug and force utf
This was missed in de0d295f6f.
2025-05-01 17:47:30 +00:00
Steffen Winter
70223c8c1c Remove unused variable 2025-05-01 17:47:30 +00:00
bad code
684fbeb583 Fix devide by 0
src/linux/btop_collect.cpp:950:106: runtime error: division by zero
    #0 0x61b286115a41 in Cpu::collect(bool) src/linux/btop_collect.cpp:950:106
    #1 0x61b285e55cb7 in Runner::_runner(void*) src/btop.cpp:533:18
    #2 0x61b285e085ca in asan_thread_start(void*) asan_interceptors.cpp.o
    #3 0x7629b7719b7a in start_thread nptl/pthread_create.c:448:8
    #4 0x7629b77977b7 in __GI___clone3 misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/linux/btop_collect.cpp:950:106
2025-05-01 11:21:51 +00:00
bad code
7906886e76 Avoid potential uninitialzed variables
Reported-by clang:

    src/linux/btop_collect.cpp:489:10: error: variable 'high' may be uninitialized when used here [-Werror,-Wconditional-uninitialized]
      489 |                                         if (high < 1) high = 80;
          |                                             ^~~~
    src/linux/btop_collect.cpp:482:18: note: initialize the variable 'high' to silence this warning
      482 |                                         int64_t high, crit;
          |                                                     ^
          |                                                      = 0
    src/linux/btop_collect.cpp:490:10: error: variable 'crit' may be uninitialized when used here [-Werror,-Wconditional-uninitialized]
      490 |                                         if (crit < 1) crit = 95;
          |                                             ^~~~
    src/linux/btop_collect.cpp:482:24: note: initialize the variable 'crit' to silence this warning
      482 |                                         int64_t high, crit;
          |                                                           ^
          |                                                            = 0
    src/linux/btop_collect.cpp:1648:29: error: variable 'totalMem' may be uninitialized when used here [-Werror,-Wconditional-uninitialized]
     1648 |                 if (not meminfo.good() or totalMem == 0)
          |                                           ^~~~~~~~
    src/linux/btop_collect.cpp:1642:19: note: initialize the variable 'totalMem' to silence this warning
     1642 |                 int64_t totalMem;
          |                                 ^
          |                                  = 0
2025-05-01 11:21:51 +00:00
bad code
9ecc10b66b Avoid stack-use-after-return
The variable free_priv is a constant bool; pass by value.
Reported by Address Sanitizer:

    SUMMARY: AddressSanitizer: stack-use-after-return src/linux/btop_collect.cpp:1931:17 in Mem::collect(bool)::$_0::operator()() const
2025-05-01 11:21:51 +00:00
bad code
1896c3a296 Avoid floating-point division by 0
Reported by UBSAN:

    src/linux/btop_collect.cpp:1933:57: runtime error: division by zero
    SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/linux/btop_collect.cpp:1933:57
    src/linux/btop_collect.cpp:2038:93: runtime error: division by zero
    SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/linux/btop_collect.cpp:2038:93
2025-05-01 11:21:51 +00:00
Xavi
7fa92c402d Initialize pti struct 2025-05-01 11:14:20 +00:00
Xavi
da9a53f4a9 Fix macos tree-mode + aggregate memory issue 2025-05-01 11:14:20 +00:00
Marie Ramlow
4812ac8280 Fix typo: Mhz -> MHz 2025-05-01 10:53:44 +00:00
aristocratos
666d31b1ab v1.4.1 2025-04-27 15:52:29 +02:00
Steffen Winter
6cab38f097 Fix various typos in code, themes and workflows 2025-04-24 19:39:27 +00:00
bad code
d40cd430b8 Mark destructor noexcept and satisfy rule-of-five
Follow the RAII paradigm and define all 5 special class function if any
of them has a non-default implementation. Avoids duplicate destruction
or other unwanted effects.
2025-04-24 19:04:02 +00:00
bad code
81cdf9d7c4 Initialize all struct fields
Avoid uninitialized members.
2025-04-24 19:04:02 +00:00
bad code
08706f49d3 Mark member variables private
Hide class internals.
2025-04-24 19:04:02 +00:00
bad code
4c4a161421 Use explicit single parameter constructor
Avoid implicit conversions; these might be unwanted or truncating.
2025-04-24 19:04:02 +00:00
bad code
5ff01e1987 Ensure NUL-termination on truncation
gethostname() might not NUL-terminate the passed buffer on truncation.
2025-04-24 19:04:02 +00:00
bad code
4d67f3211d Avoid repeated bounds check
The bounds check is done explicitly in the line before.
2025-04-24 19:04:02 +00:00
bad code
73e0520fb0 Use O_CLOEXEC
Avoid leaking file descriptor via potential sibling threads.
2025-04-24 19:04:02 +00:00
bad code
c37f68f088 Use member function instead of cast
Avoid C-style cast.
2025-04-24 19:04:02 +00:00
bad code
f72d11fe52 Avoid copy in constructor
Enable compilers to move temporary variables into the constructor.
2025-04-24 19:04:02 +00:00
bad code
889d8efce4 Drop trailing newlines 2025-04-24 19:04:02 +00:00
bad code
48a1fbe3a7 Declare local function static
Clarifies the intended scope of the functions.
2025-04-24 19:04:02 +00:00
bad code
0d14d8672f Drop duplicate include 2025-04-24 19:04:02 +00:00
bad code
c1a31fa167 Simplify ternary expression 2025-04-24 19:04:02 +00:00