# makisepel/systemprog architecture

> Architecture diagram of the GitHub repository makisepel/systemprog, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/makisepel/systemprog
- Repository: https://github.com/makisepel/systemprog

## Overview

##### Project Type and Purpose
- This is a system monitoring / task managing application written in C for Linux.
- Its core functionality is to provide real-time system and process information using a user-friendly TUI.
- The README emphasizes features such as real-time monitoring, efficient resource use, and a TUI that enhances user interaction.

##### Analysis of the File Structure
- Top-Level Files: Apart from development artifacts like the Makefile, the root contains several C source and header files.
- Core Components Identified by Files:
- main.c: The starting point of the application.
- control.c/control.h: Likely orchestrates the main workflow, coordinating other modules.
- proc_reader.c/proc_reader.h: Handles reading process-specific data, probably reading Linux’s /proc filesystem.
- system_reader.c/system_reader.h: Gathers broader system information.
- terminal_ui.c/terminal_ui.h: Implements the TUI, managing the rendering of the interface and user interaction.
- print.c/print.h: May be a helper module for outputting data to the terminal.
- sort.c/sort.h: Provides functionality for sorting collected process or system data.
- process.h: Likely contains common data structures (like process descriptors) used across different modules.
- Executable Targets: The existence of “systop” (and perhaps “systemprog” as another build target) shows that the project can be built into a runnable binary via the provided Makefile.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Initialization"
        main["main()"]:::init
    end

    subgraph "Control Layer"
        control["Control Module"]:::control
    end

    subgraph "Data Collection"
        procReader["Process Reader"]:::data
        sysReader["System Reader"]:::data
    end

    subgraph "Data Processing"
        sort["Sort Module"]:::processing
    end

    subgraph "Presentation"
        tui["Terminal UI"]:::presentation
        printMod["Print Module"]:::presentation
    end

    subgraph "Shared Core Definitions"
        processDefs["Process Definitions"]:::shared
    end

    %% Main flow
    main -->|"calls"| control
    control -->|"invokes"| procReader
    control -->|"invokes"| sysReader
    procReader -->|"fetches_data"| sort
    sysReader -->|"fetches_data"| sort
    sort -->|"provides_sorted_data"| tui
    sort -->|"provides_sorted_data"| printMod

    %% Shared definitions usage
    processDefs -.->|"shared"| control
    processDefs -.->|"shared"| procReader
    processDefs -.->|"shared"| sysReader
    processDefs -.->|"shared"| sort
    processDefs -.->|"shared"| tui
    processDefs -.->|"shared"| printMod

    %% Click Events
    click main "https://github.com/makisepel/systemprog/blob/main/main.c"
    click control "https://github.com/makisepel/systemprog/blob/main/control.c"
    click control "https://github.com/makisepel/systemprog/blob/main/control.h"
    click procReader "https://github.com/makisepel/systemprog/blob/main/proc_reader.c"
    click procReader "https://github.com/makisepel/systemprog/blob/main/proc_reader.h"
    click sysReader "https://github.com/makisepel/systemprog/blob/main/system_reader.c"
    click sysReader "https://github.com/makisepel/systemprog/blob/main/system_reader.h"
    click sort "https://github.com/makisepel/systemprog/blob/main/sort.c"
    click sort "https://github.com/makisepel/systemprog/blob/main/sort.h"
    click tui "https://github.com/makisepel/systemprog/blob/main/terminal_ui.c"
    click tui "https://github.com/makisepel/systemprog/blob/main/terminal_ui.h"
    click printMod "https://github.com/makisepel/systemprog/blob/main/print.c"
    click printMod "https://github.com/makisepel/systemprog/blob/main/print.h"
    click processDefs "https://github.com/makisepel/systemprog/blob/main/process.h"

    %% Styles for clarity
    classDef init fill:#ace,stroke:#333,stroke-width:2px
    classDef control fill:#fda,stroke:#333,stroke-width:2px
    classDef data fill:#cfc,stroke:#333,stroke-width:2px
    classDef processing fill:#fc9,stroke:#333,stroke-width:2px
    classDef presentation fill:#ccf,stroke:#333,stroke-width:2px
    classDef shared fill:#ddd,stroke:#333,stroke-width:2px
```
