How htop-dev/htop works
htop is a cross-platform interactive process and system monitor. The main workflow samples platform data, presents processes and system meters in a terminal interface, and lets users inspect, configure, and act on processes. The graph combines documented capabilities with the supplied ScreenManager and platform excerpts; several subsystem links are based on the README and tree rather than sampled implementation. Platform-specific collection is represented by Linux files, with other platform implementations also present.
Main entry points: ScreenManager.c Screen manager · Machine.c Machine model · Platform.c PCP platform · ProcessTable.c Process table
Components 20
Runtime and UI
- Application entry
htop.c - Screen manager
ScreenManager.c - System header
Header.c - System meters
Meter.c
System sampling
- Machine model
Machine.c - Platform collectors
linux/Platform.c
Process monitoring
- Process table
ProcessTable.c - Process model
Process.c - Process list
MainPanel.c - Table and sorting
Table.c
User interaction
- Process actions
Action.c - Settings
Settings.c - Setup panels
MetersPanel.c - Detail screens
InfoScreen.c
Optional capabilities
- PCP platform
pcp/Platform.c - Dynamic PCP views
pcp/PCPDynamicScreen.c - Backtrace screen
BacktraceScreen.c
Other components
- Terminal user
- Operating system
- PCP data source
Connections 22
- Terminal user → Application entry: starts
- Application entry → Screen manager: runs interface
- Screen manager → Machine model: updates host
- Machine model → Platform collectors: collects through
- Platform collectors → Operating system: reads system data
- Machine model → Process table: updates processes
- Process table → Process model: maintains records
- Screen manager → Process list: displays processes
- Process list → Table and sorting: uses table
- Screen manager → System header: updates and draws
- System header → System meters: renders meters
- Terminal user → Screen manager: navigates and selects
- Screen manager → Process actions: dispatches commands
- Process actions → Process table: targets processes
- Screen manager → Settings: reads state
- Screen manager → Setup panels: opens configuration
- Setup panels → Settings: changes options
- Screen manager → Detail screens: opens details
- Terminal user → PCP platform: selects PCP mode
- PCP platform → PCP data source: fetches metrics
- PCP platform → Dynamic PCP views: provides dynamic views
- Terminal user → Backtrace screen: requests backtrace