827 Commits

Author SHA1 Message Date
Ryan Libby
b101fb378e fix: linux process cpu usage under-reported when vm guests active (#1609)
The Linux /proc/stat fields "guest" and "guest_nice" are already
included in "user" and "nice".  In Proc::collect do like Cpu::collect
does and don't double count them.  The double-counting caused the CPU
usage denominator to be too large when VM guests were active, causing
the reported CPU usage percentages of all processes to be too small.

Closes: https://github.com/aristocratos/btop/issues/1608
2026-04-13 08:38:34 +00:00
Brent Cook
adf5c8b7e7 only display online CPUs in output
coreCount now reflects only the schedulable CPUs. With hw.smt=0 on a
4-core/8-thread machine, coreCount becomes 4, so btop allocates 4
display slots instead of 8.

The collect loop now also checks CPUSTATS_ONLINE for each CPU and skips
offline CPUs, such as disabled hyperthreads.
2026-03-27 21:04:02 -05:00
Brent Cook
a49150b4b0 fix CPU mib queries for OpenBSD
btop uses i / 2 as the third MIB index when it should be i, exactly as
top does. This causes it to query the same CPU twice in a row and skip
half the CPUs entirely.

Also use the correct size for a single cpustats struct.
2026-03-26 06:43:54 -05:00
Yinghao
6164470cb8 fix: send signal to correct process when proc list is moving (#1581)
Process signal popup menus use the "current" selected process, which can drift
around. Fix by retaining the initial PID at popup creation.

Closes: https://github.com/aristocratos/btop/issues/846
2026-03-23 16:43:34 +00:00
Yinghao
83e309cbc3 fix: always update properties of current menu option (#1579)
Closes: https://github.com/aristocratos/btop/issues/1531
2026-03-21 17:51:01 +00:00
Yinghao
e895a54626 fix: add missing format field (#1578) 2026-03-19 12:40:14 +00:00
Andrew Pam
cdc15a6081 feat: add support for AMD ROCm 7 (#1566)
The major version reported by the library is now 1, instead of 6 or 7, reported by ROCm 6.

Closes: https://github.com/aristocratos/btop/pull/1469
Closes: https://github.com/aristocratos/btop/issues/1540
2026-03-04 10:16:21 +00:00
Jakob P. Liljenberg
d76e2ca412 Merge pull request #1541 from gneitzke/feature/apple-silicon-gpu-support
feat: Add Apple Silicon GPU support via IOReport API
2026-02-15 20:44:18 +01:00
Gary Neitzke
505533a573 Add RAII wrappers for CF/IO types and update menu text
- Add CFRef<T> template for CoreFoundation types (CFRelease)
- Add IORef wrapper for IOKit object types (IOObjectRelease)
- Refactor GPU code to use RAII wrappers for all local CF/IO objects
- Add 'apple' to shown_gpus description in btop_menu.cpp
2026-02-14 12:53:29 -08:00
aristocratos
112422b4c4 Ignore warning for -Wunused-result in ~DropPrivilegeGuard() for GCC 2026-02-14 21:00:33 +01:00
Gary Neitzke
a5179a9b42 fix: Guard AppleSilicon GPU code behind __APPLE__ for cross-platform builds
- Wrap AppleSilicon::shutdown() call and declaration with #ifdef __APPLE__
  so Linux GPU builds don't get undefined reference errors
- Add IOReport library linking in CMakeLists.txt for macOS CMake builds
2026-02-14 11:51:21 -08:00
Gary Neitzke
3ec2aeeb01 feat: Add Apple Silicon GPU support via IOReport API
Add GPU monitoring for Apple Silicon Macs using the IOReport framework
and IOHIDEventSystem for temperature readings.

Metrics supported:
- GPU utilization (from GPU Performance States residency)
- GPU power consumption (from Energy Model channel)
- GPU temperature (from IOHIDEventSystem thermal sensors)
- GPU clock speed (from DVFS frequency table + residency weighting)
- Memory usage (unified memory architecture, reports system RAM)

Implementation follows the existing Nvml/Rsmi/Intel backend pattern with
init/shutdown/collect<is_init> template functions in a new AppleSilicon
namespace under Gpu.

Build system changes:
- Enable GPU_SUPPORT on macOS in both CMakeLists.txt and Makefile
- Link IOReport library on macOS
- Add 'apple' to shown_gpus vendor filter

Closes #955
2026-02-14 11:44:17 -08:00
Barry Van Deerlin
09bd0cd3fa refactor: use fmt::format in detailed view for cpu usage
Bug: https://github.com/aristocratos/btop/issues/535
2026-02-11 07:45:47 +00:00
Jakob P. Liljenberg
8fee965556 Merge pull request #1493 from vandabbin/relocate-default-preset
Feat: Preset disabling options
2026-02-07 14:45:00 +01:00
Steffen Winter
1e1eb013cb refactor: remove references to GPU code in non-gpu build 2026-02-07 13:43:52 +00:00
Steffen Winter
45c80843b3 fix: avoid calling back on emtpy temps queue
Closes: https://github.com/aristocratos/btop/issues/1438
2026-02-07 13:43:33 +00:00
Steffen Winter
651b50c112 refactor: replace custom RAII lock with stdlib 2026-02-07 13:42:59 +00:00
Jakob P. Liljenberg
a229e87eb0 Merge pull request #1515 from vandabbin/fix-force-tty-config
fix: set tty mode if force_tty is true in config file
2026-02-07 14:05:09 +01:00
Jakob P. Liljenberg
c59a9ff918 Merge pull request #1518 from vandabbin/fix-mem-smaller-than-net-gpu-build
fix: mem/net proportions different after fixing min net size / mem border
2026-02-07 14:00:49 +01:00
TheSovietPancakes
f643a3a793 Fix -Wparentheses warning 2026-01-30 19:02:52 -06:00
TheSovietPancakes
d33dbd8481 Tweaked RX/TX collection and drawing 2026-01-30 18:58:00 -06:00
Barry Van Deerlin
dbf4d05f22 fix: mem box sizing after min net box size fix 2026-01-29 12:16:55 -08:00
Barry Van Deerlin
0f6c688cb8 fix: force_tty menu option sets TTY mode on start 2026-01-29 10:53:58 -08:00
Barry Van Deerlin
6598b7d2f6 fix: net min size for gpu compiled build (#1516)
Closes: https://github.com/aristocratos/btop/issues/1509
2026-01-27 14:33:51 +00:00
Barry Van Deerlin
0b9bd79f1b fix: mem bottom border when net is not shown (#1510)
Closes: https://github.com/aristocratos/btop/issues/1508
2026-01-26 07:51:38 +00:00
Steffen Winter
633b4ba5c4 fix: suppress warning of redefined C++ keyword
Suppresses the diagnostic for clang but adds an explainatory comment why
this is needed.
2026-01-21 21:26:28 +00:00
Barry Van Deerlin
52f5e9b901 Menu option to disable presets
refactor `current_preset` as `std::optional`
2026-01-21 10:58:22 -08:00
Barry Van Deerlin
37737387ac revert: fix: don't always update metrics on redraw (#1502)
Closes: https://github.com/aristocratos/btop/issues/1500
2026-01-21 14:50:12 +00:00
Barry Van Deerlin
c611fe0e9d fix: don't always update metrics on redraw
This prevents the graphs values from updating overly fast if you hold down the preset cycle key bind or the 1, 2, 3, or 4 keys.

Closes: https://github.com/aristocratos/btop/issues/1497
2026-01-20 20:45:06 +00:00
Barry Van Deerlin
7b41990a69 Update clock with preset change or show/hide box 2026-01-17 12:29:19 -08:00
Steffen Winter
5b44daa956 chore: set all file permissions to 644 2026-01-17 18:46:33 +00:00
Steffen Winter
75e6d5819e fix: avoid useless string cast, replace with fmt::format
Bug: https://github.com/aristocratos/btop/issues/535
Ref: https://github.com/aristocratos/btop/actions/runs/21095975158/job/60673473485#step:5:39
2026-01-17 17:39:07 +00:00
Steffen Winter
881f994290 refactor: format exit messages with fmt::format
Bug: https://github.com/aristocratos/btop/issues/535
2026-01-16 19:31:47 +01:00
Steffen Winter
084b49e4f7 refactor: get rid of extern runner thread id 2026-01-16 19:31:34 +01:00
Jakob P. Liljenberg
5521ba3b4c Merge pull request #1409 from deckstose/push-wooszqkrztws 2026-01-15 20:51:36 +01:00
Jakob P. Liljenberg
8a0edbb42d Merge branch 'main' into push-muwuouvpqswu 2026-01-15 20:19:13 +01:00
Barry Van Deerlin
dca53f87e4 Fixes and Improvements for Pause and Follow modes
Reselection Issues with Pause and Follow

- I found an edge case I had missed before for the very end of the process
  list (not view). For the process list pausing feature, if the process
  selected was the very last item in the whole list then the selection was
  moved up one. And vice versa when the list is paused and the very last
  item is selected, unpausing would also move it up one item in the list.
  For the process following feature the same thing would happen when
  unfollowing (if not using the detailed view follow) but for the last few
  items (upto halfway up the view)

  - This was fixed by adding 1 to either `selected` or `start` when
    required.

- When process following with detailed view. unfollowing by clicking the
  process and then clicking again to close detail view threw the view
  off because following was disengaged.

  - Fixed with the modification to the code block that handles
    following. It now also restores the selection and view when exiting
    detailed view also. (I had a different fix for this but the fix for
    the next issue made it irrelevant and was removed)

- If following a process with detailed view and it is one of the first
  or last few items in the whole list (not view) then if you change the
  reverse sort mode and then unfollow the process, instead of the
  selection returning to the process that was being followed it returns
  to where the process would have been if the sorting wasn't reversed.

  - I struggled to figure out a fix for this but landed on reusing the
    code block that locates the followed process to restore the
    selection when detailed view closes.
  - I actually quite like this fix since it also centers the selection
    if possiple when closing the detailed view.

- The change that removed selection for detailed view following caused
  an issue where if the list was paused holding up would cause the
  selection to loop from the list position where the followed process
  was after reaching the top of the list.

  - This was fixed by adding some additional conditions before changing
    the selection back to the followed process when selected is 0
  - This gets rid of this issue so that when paused scrolling to the
    top of the list doesn't loop back to the followed process location

- When following a process and the view was at the end of the list, if
  the process died and following disengaged, a blank line would be left
  at the bottom of the list until the next collection cycle.

  - fixed this by making select_max not a const and adding 1 to it when
    the following mode disengaged.

- When the followed process is the first process in the list, pressing
  up doesn't redraw the screen and get rid of the following banner
  until the next collection cycle.

  - I fixed this by moving `bool changed = false` to the top of the
    selection function and setting `changed` to true when reselecting
    the followed process before moving back up and `selected` is 0
    again.

- When following a process clicking on the banner with the mouse would
  exit following mode and select the last line. I am not sure if this is
  desirable or not.

  - I have fixed this with an extra condition in the mouse input logic
  - This can be reverted if you feel it is good for clicking the banner
    to exit following in that way.

Improvements to follow mode list centering

- The followed process was centered using select_max / 2. this works
  but would leave it off center by 2 if select_max was odd.

  - it has been updated to use select_max / 2 if select_max is even
    which has the followed process off center as close as it can be
    but slightly closer to the top of list. if select_max is odd then
    it uses select_max / 2 + 1 which places the process dead center.

- If follow-detailed is disabled and a process is being followed while
  paused, opening or closing the detailed view doesn't recenter the
  followed process.

  - fixed this by relocating a line that sets update_following

Issue with tree expand/collapse when following

- When I made the change that set `selected = 0` when following the
  detailed process. I did not realize that this would prevent the user
  from being able to expand or collapse the tree of the process being
  followed without first unfollowing it.

  - I fixed this by slightly reworking the input code for
    expand/collapse with some extra conditions

Misc improvement to follow mode

- Added a line in the F input handling code that sets the selection to
  the followed process before exiting follow mode. This means that if
  if you press F after opening a detailed view and following that it
  will exit follow mode and move selected to the followed process
  location instead of leaving selected as 0. This is equivalent to
  pressing down after opening a detailed view when not following the
  process.

- Since when following the detailed view process the selection can be
  moved up or down from the followed process, the up arrow for the
  select button should not be greyed out if following the detailed view
  process and `should_selection_return_to_followed` is false.

- Added a comment in the selection function to explain what the
  following mode code block does there.

Small optimization for Pause mode

- I moved `Config::getB("keep_dead_proc_usage")` outside of the for loop
  that goes through all the current procs while paused.
2026-01-14 14:31:45 -08:00
Barry Van Deerlin
64476b5d08 refactor: remove redundant erasing of mouse mapping (#1473) 2026-01-14 12:13:01 +00:00
Barry Van Deerlin
39f8ebe133 fix: properly highlight down arrow if it's actionable (#1462)
Closes: #1461
2026-01-11 15:36:49 +01:00
Jakob P. Liljenberg
2e41e7686d Merge pull request #1456 from vandabbin/small-following-fix 2026-01-10 12:44:36 +01:00
aristocratos
ea977a02c4 Update widechar detection and fix replace_ascii_control() removing wide characters 2026-01-10 12:42:32 +01:00
Barry Van Deerlin
756af831c2 following mode fixes 2026-01-10 03:33:10 -08:00
Jakob P. Liljenberg
a22f371a99 Merge pull request #1454 from vandabbin/fix-kill-buttons 2026-01-10 10:40:43 +01:00
Barry Van Deerlin
1c873b08fd Fix mouse mapping for process kill buttons with vim keys enabled
The mouse mappings were only mapped as 'k' and did not change to 'K' when vim keys are enabled.
Change made so that they now map correctly

I also corrected the code that was clearing mouse mappings as it was using some uppercase letters
for keybinds that are lowercase.
2026-01-09 16:00:12 -08:00
Barry Van Deerlin
7e1e309e67 Following mode improvements
fix mouse selection when following is active

When making the change to the process following PR that made moving the selection
disengage following mode, I missed a couple points in the mouse input code that was
preventing following mode from being disengaged when clicking on the detailed info box
or on the upper border of the proc box/label line.

This alteration fixes that.

Also made a change so that if the detailed view is open/opened and
following mode engages. If the detailed view process is the one being
followed then the selection is set to 0 and the detailed view buttons
are active instead of the bottom bar buttons.

added follow button to detailed view buttons
2026-01-09 15:55:21 -08:00
Steffen Winter
bc2f2cba8e fix: remove busy waiting when checking runner thread state
Running btop with valgrind shows that when the `atomic_wait` function is
called that a couple of million instructions being executed in a short
amount of time.

The replacement puts the thread to sleep and waits for a notification
which is much more efficient.
2026-01-08 13:00:52 +01:00
Steffen Winter
4867fd4159 feat: add config option to disable mouse events 2026-01-05 00:16:39 +01:00
John
ad4e3d6d4f Change color of 'tab' in options menu for parity (#1434)
* Change color of tab in options menu

* Change tab color to use format
2026-01-04 22:29:54 +00:00
Steffen Winter
d4a58c91ec fix: adjust for additional menu tab with gpu support
The mouse click coordinates where only mapped to the first 5 tabs, but
since width of each tab decresed to make room for the gpu tab, the
mapping was of the shown strings.

Introduce a named constant that is different with gpu support enabled.

Closes: https://github.com/aristocratos/btop/issues/1430
2026-01-04 12:11:40 +01:00
Steffen Winter
fd9cd479ad refactor: use fmt::format like interface for logger
This will only allocate the log message if a log file exists and the log
level is enabled. The interface forwards it's arguments to fmt::format.
This gets also rid of some global state and hides it in the btop_log.cpp
translation unit.

Closes: https://github.com/aristocratos/btop/issues/1347
2026-01-04 12:11:21 +01:00