# sayujya-apte/atop architecture

> Architecture diagram of the GitHub repository sayujya-apte/atop, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sayujya-apte/atop
- Repository: https://github.com/sayujya-apte/atop

## Overview

Atop is a Linux process viewer with an ncurses interface. Its main loop enumerates processes, accepts keyboard navigation, and refreshes both the process list and system summary; selecting a row changes the highlight, but no detail view is shown. Process data and system-wide CPU and memory statistics are separate stages, rendered by separate UI routines. The source shows reads from Linux procfs and ncurses calls; no persistence or other integrations are documented. The graph reflects the sampled C sources and README, not unsampled implementation details.

Main entry points: [`src/main.c`](https://github.com/sayujya-apte/atop/blob/main/src/main.c) (Interactive loop), [`src/print_menu.c`](https://github.com/sayujya-apte/atop/blob/main/src/print_menu.c) (Process list), [`src/get_sys_info.c`](https://github.com/sayujya-apte/atop/blob/main/src/get_sys_info.c) (System metrics), [`src/get_proc_info.c`](https://github.com/sayujya-apte/atop/blob/main/src/get_proc_info.c) (Process enumeration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["Application control"]
  node_main["Interactive loop<br/>[main.c]"]
end

subgraph group_process["Process monitoring"]
  node_enumeration["Process enumeration<br/>[get_proc_info.c]"]
  node_process_fields["Process details<br/>[get_proc_info.c]"]
end

subgraph group_system["System monitoring"]
  node_system_metrics["System metrics<br/>[get_sys_info.c]"]
end

subgraph group_presentation["Terminal interface"]
  node_process_view["Process list<br/>[print_menu.c]"]
  node_system_view["System summary<br/>[print_menu.c]"]
end

node_user(("Operator"))
node_procfs[("Linux procfs")]
node_ncurses["ncurses terminal"]

node_user -->|"keyboard input"| node_main
node_main -->|"refreshes PIDs"| node_enumeration
node_main -->|"gets CPU count"| node_system_metrics
node_main -->|"renders list"| node_process_view
node_main -->|"renders summary"| node_system_view
node_enumeration -->|"scans /proc"| node_procfs
node_process_view -->|"gets row fields"| node_process_fields
node_process_fields -->|"reads status/stat"| node_procfs
node_system_metrics -->|"reads stat/meminfo"| node_procfs
node_process_view -->|"draws list"| node_ncurses
node_system_view -->|"gets usage"| node_system_metrics
node_system_view -->|"draws summary"| node_ncurses
node_main -->|"handles windows"| node_ncurses

click node_main "https://github.com/sayujya-apte/atop/blob/main/src/main.c"
click node_enumeration "https://github.com/sayujya-apte/atop/blob/main/src/get_proc_info.c"
click node_process_fields "https://github.com/sayujya-apte/atop/blob/main/src/get_proc_info.c"
click node_system_metrics "https://github.com/sayujya-apte/atop/blob/main/src/get_sys_info.c"
click node_process_view "https://github.com/sayujya-apte/atop/blob/main/src/print_menu.c"
click node_system_view "https://github.com/sayujya-apte/atop/blob/main/src/print_menu.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main toneBlue
class node_enumeration,node_process_fields,node_procfs toneAmber
class node_system_metrics toneMint
class node_process_view,node_system_view toneRose
class node_user,node_ncurses toneIndigo
```

## Components

### Application control

- [Interactive loop](https://github.com/sayujya-apte/atop/blob/main/src/main.c): `src/main.c`

### Process monitoring

- [Process enumeration](https://github.com/sayujya-apte/atop/blob/main/src/get_proc_info.c): `src/get_proc_info.c`
- [Process details](https://github.com/sayujya-apte/atop/blob/main/src/get_proc_info.c): `src/get_proc_info.c`

### System monitoring

- [System metrics](https://github.com/sayujya-apte/atop/blob/main/src/get_sys_info.c): `src/get_sys_info.c`

### Terminal interface

- [Process list](https://github.com/sayujya-apte/atop/blob/main/src/print_menu.c): `src/print_menu.c`
- [System summary](https://github.com/sayujya-apte/atop/blob/main/src/print_menu.c): `src/print_menu.c`

### Other components

- **Operator**
- **Linux procfs**
- **ncurses terminal**

## Connections

- Operator → Interactive loop: keyboard input
- Interactive loop → Process enumeration: refreshes PIDs
- Interactive loop → System metrics: gets CPU count
- Interactive loop → Process list: renders list
- Interactive loop → System summary: renders summary
- Process enumeration → Linux procfs: scans /proc
- Process list → Process details: gets row fields
- Process details → Linux procfs: reads status/stat
- System metrics → Linux procfs: reads stat/meminfo
- Process list → ncurses terminal: draws list
- System summary → System metrics: gets usage
- System summary → ncurses terminal: draws summary
- Interactive loop → ncurses terminal: handles windows
