hariel1985 6f60dd7ad8 Pause view updates while no window is visible; fix zero-value flicker
The window left open all day grew the app by ~360 MB in 24 h even after
the .tabItem fix. Isolating each piece in lab builds showed the growth is
the sum of several small framework leaks on macOS 26.6 that fire on every
view update: SwiftUI Table cell updates, AppKit text-cell KVO
dependencies (NSKeyValueDependency) and an ObservationRegistrar created
inside DesignLibrary. With the window closed every counter stayed flat;
minimized or fully covered, SwiftUI kept updating and kept leaking.

- WindowVisibility tracks whether any TopManager window is on screen
  (occlusion state; the status item's host window is ignored).
- SystemMonitor records into an always-current LiveState and only
  mirrors it into the @Published properties while something is visible.
  Resuming publishes everything at once, so views catch up immediately.
  Metrics history, alerts and the menu bar keep running while paused.
- MenuBarStatus carries the pre-formatted menu-bar strings, republished
  only when the visible text changes.
- AlertCenter assigns healthScore/diagnosis only when they change.
- Monitoring now starts in applicationDidFinishLaunching instead of the
  main window's onAppear, so it also runs when the app launches with no
  window (state restoration after the window was closed).

Also fixes a visible bug: ProcessMonitor's lightweight refresh (2 of
every 3 fetches) emitted 0 for memory, CPU and threads instead of the
last known values, so ~90% of rows showed "Zero KB" most of the time.

Verified in an isolated lab instance: minimized or covered, all leak
counters stay flat while the menu-bar title keeps updating; a partially
visible window updates every tick. Growth while the window is actually
visible (~190 KB/min) is unchanged — those leaks are in Apple's
frameworks. 58/58 tests pass, including a regression test that fails on
the old code (472 of 487 own processes reported 0 memory).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-16 13:53:10 +02:00
2026-09-16 10:25:42 +02:00

TopManager

A native macOS system monitor application built with SwiftUI. TopManager provides real-time monitoring of system resources including processes, applications, CPU, memory, GPU, storage, and network.

macOS Swift License Release

Download

⬇️ Download TopManager 1.0 (.dmg)

Signed with a Developer ID and notarized by Apple — it opens without Gatekeeper warnings. Open the DMG and drag TopManager to your Applications folder. All releases.

Screenshots

Processes

Processes

Apps

Apps

Performance - CPU

CPU

Performance - Memory

Memory

Performance - Network

Network

Power & Storage

Power & Storage

Features

Processes Tab

  • View all running processes with CPU, memory, thread, energy-impact, and per-process disk I/O information
  • Sort by any column (name, PID, CPU/Core, CPU/Total, Energy, memory, Disk I/O, threads, user, state)
  • Process states: Running, Sleeping, Stopped, Zombie
  • Context menu to terminate, force kill, suspend, or resume processes
  • Deep-dive inspector (double-click / ⌘I): full executable path, launch arguments, open-file count, disk totals, energy, parent PID, Reveal in Finder
  • Search processes by name or PID

Apps Tab

  • View running user-facing applications
  • Shows app icons, CPU/memory usage, and bundle identifiers
  • Quick actions: Activate, Hide, Quit, Force Quit
  • Copy bundle ID to clipboard

Performance Tab

  • Real-time CPU usage graphs (global and per-core)
  • Selectable time range (Live / 5m / 30m / 1h / 24h) backed by persistent history
  • Memory usage visualization with donut chart
  • Network throughput monitoring
  • Support for Apple Silicon P-cores and E-cores

Power & Storage Tab

  • System Health score (0–100) with plain-language diagnosis of what's wrong
  • Recent Alerts inbox
  • Battery & Power: charge, health (cycle-adjusted), cycle count, condition, temperature, power draw, time remaining, adapter wattage (via IOKit)
  • System status: macOS version, uptime, thermal state
  • CPU and GPU core counts
  • GPU memory/VRAM usage
  • Storage volumes with usage bars
  • Network interface statistics

Proactive monitoring

  • Alerts engine with native macOS notifications on sustained high CPU, critical memory pressure, disk almost full, thermal throttling, runaway processes, and low battery — de-duplicated so you're never spammed
  • Persistent metric history stored to disk; trends survive restarts

Menu Bar

  • Configurable menu-bar metric (CPU % / Memory % / Health / Download)
  • Dropdown with live CPU/memory/network/GPU/battery, System Health score, and Top CPU Consumers with one-click quit

Settings (⌘,)

  • Launch at login (SMAppService)
  • Adjustable refresh interval (1–30 s)
  • Notification toggle and alert thresholds (CPU, disk, low battery)

Requirements

  • macOS 13.0 or later
  • Xcode 15.0 or later (for building)

Building

  1. Clone the repository:

    git clone https://github.com/hariel1985/TopManager.git
    
  2. Open TopManager.xcodeproj in Xcode

  3. Build and run (⌘R)

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

Testing

Logic is covered by an XCTest suite (TopManagerTests, 55 tests) run via scripts/test.sh test. The full manual + automated process is documented in docs/TESTING.md, and the product direction in docs/VALUE_PLAN.md.

Acknowledgments

Built with SwiftUI and native macOS APIs including:

  • libproc / rusage_info for process information, disk I/O and energy signals
  • IOKit for GPU, battery (AppleSmartBattery) and hardware monitoring
  • Metal for GPU detection
  • SystemConfiguration for network monitoring
  • UserNotifications for proactive alerts
  • ServiceManagement (SMAppService) for launch-at-login
  • Swift Charts for time-series visualization
Leírás
No description provided
Readme GPL-3.0 4,1 MiB
Languages
Swift 99.7%
Shell 0.3%