1612 Commits

Author SHA1 Message Date
renovate[bot]
d03b839ec2 chore(deps): update vmactions/netbsd-vm action to v1.4.0 2026-06-06 10:35:23 +00:00
renovate[bot]
160d04a4e7 chore(deps): update vmactions/openbsd-vm action to v1.4.3 2026-06-04 08:42:12 +00:00
Jakob P. Liljenberg
fb3b55365f Merge pull request #1694 from aristocratos/osx-link-frameworks
fix: link against core and io frameworks on all apple hardware
2026-06-03 20:12:55 +02:00
renovate[bot]
ac4e7f0cb3 chore(deps): update actions/checkout action to v6.0.3 2026-06-03 09:09:27 +00:00
Steffen Winter
9213f1d316 fix: link against core and io frameworks on all apple hardware
Closes: https://github.com/aristocratos/btop/issues/1693
2026-06-02 23:31:52 +02:00
Jakob P. Liljenberg
24f2dd29aa Merge pull request #1690 from jsquyres/fix-macos-swap-disk-crash
fix: avoid macOS swap disk crash [AI generated]
2026-06-01 20:50:53 +02:00
Jeff Squyres
b8fb0df377 fix: avoid macOS swap disk crash [AI generated]
Skip the synthetic swap disk entry when collecting filesystem stats on macOS. The swap row is not a real mountpoint, so calling statvfs() on it fails and leaves the async disk-stat future in an error path.

Also release IOKit properties only when IORegistryEntryCreateCFProperties() succeeds and returns a valid object, avoiding an unsafe CFRelease() after failed property creation.
2026-06-01 11:11:05 -04:00
renovate[bot]
3f677920ce Update vmactions/freebsd-vm action to v1.4.6 2026-05-31 11:41:50 +00:00
aristocratos
9b00bbdb8b Fix Makefile colors 2026-05-31 00:38:29 +02:00
Jakob P. Liljenberg
568320f674 Merge pull request #1667 from zzallirog/feat/proc-tree-auto-collapse
proc: add proc_tree_auto_collapse option
2026-05-31 00:05:08 +02:00
zzalli
e79c7fbbe5 proc: add proc_tree_auto_collapse option
Auto-collapse processes with N or more direct children when entering
tree mode. Root-level processes (depth 0 and 1) are never collapsed.

Useful for multi-process apps like Chromium, Firefox, or Electron apps
that spawn dozens of subprocesses and clutter the tree view.

Default is 0 (disabled). Example: proc_tree_auto_collapse = 4
2026-05-31 00:37:02 +03:00
Curtis Doty
e285fd0882 Improve Makefile readability by symbolizing ANSI (#1425)
Co-authored-by: aristocratos <gnmjpl@gmail.com>
2026-05-30 23:32:51 +02:00
Jakob P. Liljenberg
41cd493b6b Merge pull request #1561 from Saphereye/unit-fix
Switch unit string literals to be SI compliant
2026-05-30 22:43:53 +02:00
Jakob P. Liljenberg
3d1d3493f6 Merge pull request #1661 from mgajda/feat/amd-igpu-sysfs-v2
[AI generated] AMD APU/iGPU sysfs backend for GPU monitoring
2026-05-30 22:30:06 +02:00
Jakob P. Liljenberg
88df2ca515 Merge pull request #1663 from jsquyres/fix/log-iso8601-timestamps
fix: use ISO 8601 format for log timestamps [AI generated]
2026-05-30 10:22:21 +02:00
Jakob P. Liljenberg
1cbaf92144 Merge pull request #1674 from jsquyres/fix/sigwinch-resize-reentry
fix: defer SIGWINCH resize handling [AI generated]
2026-05-30 10:20:42 +02:00
Jakob P. Liljenberg
2fb9796e6f Merge pull request #1658 from DerPlayer2001/main
Fix: Macos SIGABRT Crash during SMB TimeMachine Backups [AI generated]
2026-05-30 10:17:22 +02:00
Jakob P. Liljenberg
fd57e9c841 Merge pull request #1648 from NLagwal/fix-macos-regression
fix: gate Apple Silicon GPU support to unbreak intel Mac builds (#1641)
2026-05-30 10:12:39 +02:00
Jakob P. Liljenberg
2bc18e826e Merge pull request #1662 from jsquyres/fix/collector-futures
Fix possible thread deadlocks and power-event-based false stall detections
2026-05-30 10:11:22 +02:00
DerPlayer
2e7d8d395e Fix: Macos SIGABRT Crash during SMB TimeMachine Backups 2026-05-29 14:02:10 +02:00
renovate[bot]
fa202202c2 Update vmactions/openbsd-vm action to v1.4.2 2026-05-29 08:11:39 +00:00
renovate[bot]
dac428bec9 Update vmactions/netbsd-vm action to v1.3.9 2026-05-29 08:10:30 +00:00
Jakob P. Liljenberg
42267b32b6 Merge pull request #1652 from chiluk/chiluk/1651-fix-amd-gpu-graph
Fix btop with amd gpu on rocm 7 as in Ubuntu 26.04
2026-05-28 13:09:12 +02:00
renovate[bot]
83e44ff38d Update dependency macos to v26 2026-05-25 11:55:10 +00:00
renovate[bot]
8764ee5b25 Update vmactions/openbsd-vm action to v1.4.1 2026-05-25 11:48:40 +00:00
Jeff Squyres
43bfed7202 fix: defer SIGWINCH resize handling [AI generated]
Avoid running the full terminal resize path from the signal handler so resize notifications cannot reenter term_resize() while it already holds its guard.
2026-05-24 09:26:21 -04:00
Jeff Squyres
08d722aa89 fix: make wait_for timeout suspend-aware [AI generated]
Change atomic_waiting_lock::wait_for() so its timeout is measured with
an uptime clock that pauses during system suspend, while still using the
condition variable for wakeups.

Previously, std::condition_variable::wait_for() owned the timeout. If
the system suspended while the main thread was waiting for the runner
to finish, the condition-variable timeout clock could include the
suspend duration (this definitely happens on macOS). On resume, the
wait could immediately time out even though the runner had only had
milliseconds of awake time to make progress.

The new uptime_micros() helper uses the best available clock on each
platform:

- macOS: CLOCK_UPTIME_RAW (pauses during Sleep/Deep Idle)
- FreeBSD: CLOCK_UPTIME (explicitly excludes suspend time)
- Linux/OpenBSD/NetBSD: CLOCK_MONOTONIC (excludes suspend on Linux;
  best available on other platforms)

This preserves the condition-variable locking model, but makes the
stall timeout count *awake* time rather than *wall clock* or *suspend*
time.

Co-authored-by: ItsMeSamey <sameychain5041@gmail.com>
2026-05-23 09:39:12 -04:00
Jeff Squyres
3c6cfda26a fix(osx): use futures for sensor collection, remove pthread_cancel [AI generated]
Replace synchronous IOKit HID sensor reads with std::async futures
and remove all pthread_cancel() calls from the runner stall-recovery
path. This addresses the macOS/NetBSD deadlocks reported in #1349.

The root cause of the deadlocks is that pthread_cancel() does not
reliably invoke C++ destructors on macOS (libc++) or NetBSD
(libstdc++), leaving mutexes and semaphore internals wedged when the
runner thread is cancelled mid-collection.

Sensor collection via futures:

  Wrap the IOKit HID thermal sensor reads (getSensors) and SMC
  temperature reads in a std::async future, following the same pattern
  already used for statvfs in the Linux disk collector. Each collection
  cycle checks if the previous cycle's future is ready (non-blocking),
  grabs the result if so, and launches a new async. Temperature
  readings are delayed by at most one collection cycle (~2s), which is
  imperceptible to users.

  This moves the dominant cost (~130ms mean, ~700ms worst case from
  77 Mach IPC roundtrips to IOKit HID sensors) off the runner's
  critical path, reducing the runner cycle from ~180ms to ~50ms.

Remove pthread_cancel from stall recovery:

  Replace the 5-second timeout + pthread_cancel + thread recreation
  logic with a 10-second warning + 30-second clean exit. If the runner
  is still stalled after 30 seconds (which should be nearly impossible
  with sensor reads off the critical path), btop exits cleanly rather
  than risking undefined behavior from pthread_cancel.

  This follows the maintainer's recommendation: remove pthread_cancel
  for BSD-derived platforms and exit with an error if the thread
  stalls, with an extended timeout to allow recovery from transient
  OS-level delays (sleep/wake transitions, IOKit contention).

  All three timeout sites are updated:
  - Runner::run(): 10s warning, 30s exit (was 5s + pthread_cancel)
  - Runner::stop(): 30s exit (was 5s)
  - Runner thread loop: 30s (was 5s)
  - clean_quit(): remove pthread_cancel fallback from thread join

Fixes #1349
2026-05-23 09:32:14 -04:00
Jakob P. Liljenberg
a7d27a61c7 Merge pull request #1649 from ItsMeSamey/locking_fix
Fix atomic issues and data races in btop
2026-05-23 01:23:03 +02:00
ItsMeSamey
3b2149ed27 Merge remote-tracking branch 'origin/main' into locking_fix
# Conflicts:
#	src/btop_menu.cpp
2026-05-23 03:36:26 +10:00
Jordan Lambert
86ed12037a feat: map = to + to avoid having to press shift when increasing refresh rate (#1665) 2026-05-18 19:13:54 +00:00
Jeff Squyres
31d4c9c84f fix: use ISO 8601 format for log timestamps [AI generated]
Change log timestamps from the custom format to ISO 8601 with UTC
indicator:

  Before: 2026-05-14 (10:31:47) | DEBUG: ...
  After:  2026-05-14T10:31:47Z | DEBUG: ...

The previous format used parentheses around the time and omitted any
timezone indicator, making timestamps ambiguous. The logger uses
std::chrono::system_clock which measures time since Unix epoch (UTC
on all platforms), but the old format did not communicate this.

ISO 8601 with the Z suffix is an unambiguous, universally-recognized
format parseable by standard functions across languages:
- C++ (C++20): std::chrono::from_stream(ss, "%FT%TZ", tp)
- C: strptime(s, "%Y-%m-%dT%H:%M:%SZ", &tm)
- Python: datetime.fromisoformat("2026-05-14T10:31:47Z")

This matters for correlating btop log events with system logs (e.g.,
macOS pmset power events) that use local time with explicit timezone
offsets.
2026-05-17 16:46:24 -04:00
Michal J. Gajda
e2479bba01 [AI generated] feat(linux): AMD APU/iGPU sysfs backend for GPU monitoring
This PR is AI-assisted (per CONTRIBUTING.md disclosure requirement).
Reviewed and tested by the author; independently confirmed by @rnk.

Adds Gpu::Asysfs, a pure-sysfs fallback that activates only when
rocm-smi enumerates 0 AMD devices. Covers consumer hardware where
ROCm libraries are absent or /dev/kfd isn't loaded — typical for
APUs (Phoenix/Strix-class iGPUs) and older discrete cards no longer
supported by ROCm.

Closes #1643. Related: #1169, #1045, #956.

Scope is deliberately additive:
  * No change of behavior on hardware where rocm-smi already works.
  * Not a migration to amd-smi (#1196 remains open and warranted
    for the discrete-GPU case the sysfs path may not fully cover).
  * @rnk's parallel dlopen(libamd_smi.so) draft lives at
    https://github.com/rnk/btop/compare/main...amd-smi-sysfs as a
    complementary direction for discrete GPUs.

Reads only standard amdgpu DRM sysfs nodes — no library dependency,
no dlopen, pure file I/O:
  device/gpu_busy_percent     -> utilization
  device/mem_info_vram_*      -> VRAM total / used
  hwmon*/temp1_input          -> temperature (millidegrees -> degrees)
  hwmon*/freq1_input          -> core clock (Hz -> MHz)
  hwmon*/power1_average       -> power (microwatts -> milliwatts),
                                 falls back to power1_input

Filters by PCI vendor 0x1002 and driver=amdgpu, so does not collide
with nvidia/intel backends. Skips connector children (card1-DP-1)
and render nodes via filename pattern. Cards exposing no readable
signals (virtual GPUs, freshly-bound devices) are dropped at
enumeration rather than rendered as empty entries every tick.

Code follows CONTRIBUTING.md style: tabs of 4, alternative operators
(and/or/not), opening brace at line end, RAII (no raw resources;
std::filesystem::path / std::string / std::vector throughout),
std::ranges algorithms (all_of), fmt::format for the device-id
label, descriptive names, comments on non-obvious logic only.

Macros/files touched:
  src/btop.cpp               +1   (Asysfs::shutdown in clean_quit)
  src/btop_shared.hpp        +3   (forward declare Asysfs::shutdown)
  src/linux/btop_collect.cpp +218 (the backend)
  src/osx/btop_collect.cpp   +1   (no-op shutdown stub for the
                                   GPU_SUPPORT path used by Apple
                                   Silicon, so the macOS link works)

Tested on Strix-class iGPU (PCI 1002:150e, Radeon 780M variant):
  - btop displays "AMD GPU (1002:150e)" as gpu0
  - utilization, temperature, power, clock, VRAM used/total live-update
  - matches sysfs values within sampling jitter

Independently confirmed by @rnk on AMD APU Framework laptop.

Warning sweep clean under -Wall -Wextra -pedantic -Wconversion
-Wshadow -Wfloat-conversion (zero new warnings introduced).
2026-05-17 11:49:47 +00:00
renovate[bot]
55a62250e9 chore(deps): update zizmorcore/zizmor-action action to v0.5.6 2026-05-16 22:47:05 +00:00
renovate[bot]
d45db6dcae chore(deps): update zizmorcore/zizmor-action action to v0.5.4 2026-05-15 16:14:03 +00:00
Jakob P. Liljenberg
d31007daba Merge pull request #1390 from katexochen/p/theme-dir
themes: load/save by name if possible
2026-05-14 09:19:43 +02:00
Paul Meyer
30b3868787 themes: load/save by name if possible
This fixes #443 and a downstream issue in nixpkgs:
https://github.com/NixOS/nixpkgs/issues/460344

Short description of the latter issue: I nixpkgs, different versions
of btop are installed under different paths. If a user selects a
theme and it is saved to the config by its absolute path, that path
will be broken after an update.

To solve this, we allow writing the theme name only into the config,
and we save the theme by name if possible.

When selecting a theme, we check if it is the first (with respect to
the load oder priority: custom > user > system) match for this
filename in the list of available themes. If it is, we save it by
filename instead of using the full path. If there is another theme
with the same name and higher priority, we save using the full path.

This should also be compatible with the previous behavior of being
able to load themes by name from $XDG_CONFIG_PATH/btop/themes.

Signed-off-by: Paul Meyer <katexochen0@gmail.com>
2026-05-13 10:27:39 +02:00
ItsMeSamey
2c631e4c8f introduced seperate class for waiting with timeout 2026-05-09 19:15:44 +10:00
ItsMeSamey
312592f01e remove useless not_true flag and use single wakes 2026-05-09 17:24:52 +10:00
Dave Chiluk
07fff6c6cd Fix btop with amd gpu on rocm 7 as in Ubuntu 26.04
Fixes #1651

Signed-off-by: Dave Chiluk <chiluk@ubuntu.com>
2026-05-09 00:23:58 -05:00
ItsMeSamey
5aaca91b3b made fail ordering for atom.compare_exchange_strong to be relaxed 2026-05-08 15:17:43 +10:00
ItsMeSamey
327f69517d fix gpu devide name leak 2026-05-08 14:35:36 +10:00
ItsMeSamey
3843042b4f Donot call async-signal-unsafe function clean_quit inside of the signal handler 2026-05-08 03:41:03 +10:00
ItsMeSamey
88b0ed67e6 Fixed atomic primitives [well hopefully]
The original code used relaxed ordering which does not fence reordering.
Relaxed atomics infact are identical to volatile variables [on x86
atleast]
compare&swap was wrong too and not resetting the variable to false
correctly.
Stores were using strict ordering which is not actually required.
2026-05-08 03:22:34 +10:00
ItsMeSamey
677336f8ba found and fixed 2 more potential races 2026-05-08 02:15:50 +10:00
ItsMeSamey
557fbe519b fixed ui race 2026-05-08 01:52:33 +10:00
NLagwal
b65687d19e fix: Added check for arm64 in CMakeLists.txt 2026-05-07 13:05:45 +05:30
Nakul Lagwal
018afadd2b fix: fixed typo 2026-05-07 07:15:07 +00:00
Nakul Lagwal
1e7bb4205f fix: restore macOS headers and local includes for ARM builds 2026-05-07 07:12:41 +00:00
NLagwal
542f3d7f1f fix: gate Apple Silicon GPU support conditionally to unbreak intel Mac builds (#1641) 2026-05-07 12:31:15 +05:30