# c0xc/capacitytester architecture

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

- Interactive diagram: https://gitdiagram.com/c0xc/capacitytester
- Repository: https://github.com/c0xc/capacitytester

## Overview

CapacityTester is a desktop/CLI utility for checking whether flash storage provides its advertised capacity. Users select a mounted filesystem for a non-destructive fill-and-verify volume test, or an unmounted device for the faster, destructive raw-disk test; Linux also provides device selection and formatting support. The graph retains the documented format and progress-display capabilities. Source excerpts establish component references and responsibilities, but do not expose every runtime call, so uncertain connections are omitted.

Main entry points: [`src/capacitytestergui.cpp`](https://github.com/c0xc/capacitytester/blob/master/src/capacitytestergui.cpp) (Desktop workflow), [`src/capacitytestercli.cpp`](https://github.com/c0xc/capacitytester/blob/master/src/capacitytestercli.cpp) (Command-line workflow), [`src/volumetester.cpp`](https://github.com/c0xc/capacitytester/blob/master/src/volumetester.cpp) (Volume test), [`src/destructivedisktester.cpp`](https://github.com/c0xc/capacitytester/blob/master/src/destructivedisktester.cpp) (Raw disk test)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User interfaces"]
  node_gui["Desktop workflow"]
  node_cli["Command-line workflow"]
end

subgraph group_selection["Device selection"]
  node_selectwindow["Selection window"]
  node_diskselect["Disk selection"]
  node_usbselect["USB selection dialog"]
end

subgraph group_testing["Capacity tests"]
  node_volume["Volume test<br/>[volumetester.cpp]"]
  node_disk["Raw disk test"]
  node_diskwrapper["Disk test wrapper"]
end

subgraph group_support["Storage and display"]
  node_udisk["UDisks management<br/>[udiskmanager.cpp]"]
  node_usbdevice["USB device details"]
  node_format["Drive formatting"]
  node_graph["Performance graphs"]
end

node_user(("User"))
node_filesystem[("Mounted filesystem")]
node_storage[("USB storage device")]

node_user -->|"uses"| node_gui
node_user -->|"uses"| node_cli
node_gui -->|"references"| node_selectwindow
node_gui -->|"references"| node_volume
node_gui -->|"references"| node_disk
node_gui -->|"references"| node_diskwrapper
node_gui -->|"references"| node_usbdevice
node_gui -->|"references"| node_graph
node_cli -->|"references"| node_volume
node_cli -->|"references"| node_disk
node_selectwindow -->|"references"| node_udisk
node_usbselect -->|"references"| node_diskselect
node_diskselect -->|"uses"| node_udisk
node_volume -->|"writes and verifies"| node_filesystem
node_disk -->|"overwrites and verifies"| node_storage
node_udisk -.->|"manages"| node_storage
node_gui -->|"offers formatting"| node_format

click node_gui "https://github.com/c0xc/capacitytester/blob/master/src/capacitytestergui.cpp"
click node_cli "https://github.com/c0xc/capacitytester/blob/master/src/capacitytestercli.cpp"
click node_selectwindow "https://github.com/c0xc/capacitytester/blob/master/src/selectionwindow.cpp"
click node_diskselect "https://github.com/c0xc/capacitytester/blob/master/src/storagediskselection.cpp"
click node_usbselect "https://github.com/c0xc/capacitytester/blob/master/src/usbdiskselectiondialog.cpp"
click node_volume "https://github.com/c0xc/capacitytester/blob/master/src/volumetester.cpp"
click node_disk "https://github.com/c0xc/capacitytester/blob/master/src/destructivedisktester.cpp"
click node_diskwrapper "https://github.com/c0xc/capacitytester/blob/master/src/destructivedisktesterwrapper.cpp"
click node_udisk "https://github.com/c0xc/capacitytester/blob/master/src/udiskmanager.cpp"
click node_usbdevice "https://github.com/c0xc/capacitytester/blob/master/src/usbstoragedevice.cpp"
click node_format "https://github.com/c0xc/capacitytester/blob/master/src/udiskformatdialog.cpp"
click node_graph "https://github.com/c0xc/capacitytester/blob/master/src/performancegraph.cpp"

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_gui,node_cli,node_user toneBlue
class node_selectwindow,node_diskselect,node_usbselect,node_filesystem,node_storage toneAmber
class node_volume,node_disk,node_diskwrapper toneMint
class node_udisk,node_usbdevice,node_format,node_graph toneRose
```

## Components

### User interfaces

- [Desktop workflow](https://github.com/c0xc/capacitytester/blob/master/src/capacitytestergui.cpp): `src/capacitytestergui.cpp`
- [Command-line workflow](https://github.com/c0xc/capacitytester/blob/master/src/capacitytestercli.cpp): `src/capacitytestercli.cpp`

### Device selection

- [Selection window](https://github.com/c0xc/capacitytester/blob/master/src/selectionwindow.cpp): `src/selectionwindow.cpp`
- [Disk selection](https://github.com/c0xc/capacitytester/blob/master/src/storagediskselection.cpp): `src/storagediskselection.cpp`
- [USB selection dialog](https://github.com/c0xc/capacitytester/blob/master/src/usbdiskselectiondialog.cpp): `src/usbdiskselectiondialog.cpp`

### Capacity tests

- [Volume test](https://github.com/c0xc/capacitytester/blob/master/src/volumetester.cpp): `src/volumetester.cpp`
- [Raw disk test](https://github.com/c0xc/capacitytester/blob/master/src/destructivedisktester.cpp): `src/destructivedisktester.cpp`
- [Disk test wrapper](https://github.com/c0xc/capacitytester/blob/master/src/destructivedisktesterwrapper.cpp): `src/destructivedisktesterwrapper.cpp`

### Storage and display

- [UDisks management](https://github.com/c0xc/capacitytester/blob/master/src/udiskmanager.cpp): `src/udiskmanager.cpp`
- [USB device details](https://github.com/c0xc/capacitytester/blob/master/src/usbstoragedevice.cpp): `src/usbstoragedevice.cpp`
- [Drive formatting](https://github.com/c0xc/capacitytester/blob/master/src/udiskformatdialog.cpp): `src/udiskformatdialog.cpp`
- [Performance graphs](https://github.com/c0xc/capacitytester/blob/master/src/performancegraph.cpp): `src/performancegraph.cpp`

### Other components

- **User**
- **Mounted filesystem**
- **USB storage device**

## Connections

- User → Desktop workflow: uses (evidence: `README.md`)
- User → Command-line workflow: uses (evidence: `README.md`)
- Desktop workflow → Selection window: references
- Desktop workflow → Volume test: references
- Desktop workflow → Raw disk test: references
- Desktop workflow → Disk test wrapper: references
- Desktop workflow → USB device details: references
- Desktop workflow → Performance graphs: references
- Command-line workflow → Volume test: references
- Command-line workflow → Raw disk test: references
- Selection window → UDisks management: references
- USB selection dialog → Disk selection: references
- Disk selection → UDisks management: uses
- Volume test → Mounted filesystem: writes and verifies (evidence: `README.md`)
- Raw disk test → USB storage device: overwrites and verifies (evidence: `README.md`)
- UDisks management → USB storage device: manages
- Desktop workflow → Drive formatting: offers formatting
