# gooda/perf_monitor architecture

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

- Interactive diagram: https://gitdiagram.com/gooda/perf_monitor
- Repository: https://github.com/gooda/perf_monitor

## Overview

iOS Perf Monitor is a React dashboard that connects to an iOS performance backend, consumes live WebSocket metrics and stack traces, stores them as monitoring state, and presents overview, per-process, and stack-analysis views. The graph separates connection/ingestion, metric state, dashboard modes, and presentation. The README documents the backend contract and the three modes; source excerpts and the SOURCE INDEX support the shown internal links, but do not establish every chart’s precise data path.

Main entry points: [`src/App.tsx`](https://github.com/gooda/perf_monitor/blob/master/src/App.tsx) (App shell), [`src/components/panels/OverviewPanel.tsx`](https://github.com/gooda/perf_monitor/blob/master/src/components/panels/OverviewPanel.tsx) (System overview), [`src/components/panels/ProcessPanel.tsx`](https://github.com/gooda/perf_monitor/blob/master/src/components/panels/ProcessPanel.tsx) (Process analysis), [`src/stores/perfStore.ts`](https://github.com/gooda/perf_monitor/blob/master/src/stores/perfStore.ts) (Performance store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Dashboard"]
  node_entry["App shell<br/>[App.tsx]"]
end

subgraph group_ingest["Connection &amp; Ingestion"]
  node_connection["Connection controls"]
  node_hook["WebSocket hook<br/>[useWebSocket.ts]"]
  node_ws["WebSocket service<br/>[websocket.ts]"]
end

subgraph group_state["Monitoring State"]
  node_store["Performance store<br/>[perfStore.ts]"]
  node_theme["Theme store<br/>[themeStore.ts]"]
end

subgraph group_views["Analysis Views"]
  node_overview["System overview<br/>[OverviewPanel.tsx]"]
  node_process["Process analysis<br/>[ProcessPanel.tsx]"]
  node_detailed["Stack analysis<br/>[DetailedPanel.tsx]"]
end

subgraph group_presentation["Charts &amp; Theme"]
  node_metric["Metric cards<br/>[MetricCard.tsx]"]
  node_line["Line chart<br/>[LineChart.tsx]"]
  node_multi["Multi-line chart<br/>[MultiLineChart.tsx]"]
  node_area["Stacked area chart"]
  node_bidirectional["Bidirectional chart"]
  node_flame["Flame graph<br/>[FlameGraph.tsx]"]
  node_themeui["Theme toggle<br/>[ThemeToggle.tsx]"]
end

node_user(("Dashboard user"))
node_backend["ios_perf backend"]

node_user -->|"uses"| node_entry
node_entry -->|"renders"| node_connection
node_entry -->|"selects view"| node_overview
node_entry -->|"selects view"| node_process
node_entry -->|"selects view"| node_detailed
node_entry -->|"renders"| node_themeui
node_connection -->|"controls"| node_hook
node_hook -->|"calls"| node_ws
node_ws -->|"exchanges metrics"| node_backend
node_hook -->|"updates"| node_store
node_overview -->|"reads metrics"| node_store
node_process -->|"reads process data"| node_store
node_detailed -->|"reads stack data"| node_store
node_overview -.->|"renders"| node_metric
node_overview -.->|"renders"| node_line
node_overview -.->|"renders"| node_multi
node_process -->|"renders"| node_metric
node_process -->|"renders"| node_area
node_process -->|"renders"| node_bidirectional
node_detailed -.->|"renders"| node_flame
node_themeui -->|"updates"| node_theme
node_entry -->|"initializes"| node_theme

click node_entry "https://github.com/gooda/perf_monitor/blob/master/src/App.tsx"
click node_connection "https://github.com/gooda/perf_monitor/blob/master/src/components/panels/ConnectionPanel.tsx"
click node_hook "https://github.com/gooda/perf_monitor/blob/master/src/hooks/useWebSocket.ts"
click node_ws "https://github.com/gooda/perf_monitor/blob/master/src/services/websocket.ts"
click node_store "https://github.com/gooda/perf_monitor/blob/master/src/stores/perfStore.ts"
click node_overview "https://github.com/gooda/perf_monitor/blob/master/src/components/panels/OverviewPanel.tsx"
click node_process "https://github.com/gooda/perf_monitor/blob/master/src/components/panels/ProcessPanel.tsx"
click node_detailed "https://github.com/gooda/perf_monitor/blob/master/src/components/panels/DetailedPanel.tsx"
click node_metric "https://github.com/gooda/perf_monitor/blob/master/src/components/ui/MetricCard.tsx"
click node_line "https://github.com/gooda/perf_monitor/blob/master/src/components/charts/LineChart.tsx"
click node_multi "https://github.com/gooda/perf_monitor/blob/master/src/components/charts/MultiLineChart.tsx"
click node_area "https://github.com/gooda/perf_monitor/blob/master/src/components/charts/StackedAreaChart.tsx"
click node_bidirectional "https://github.com/gooda/perf_monitor/blob/master/src/components/charts/BidirectionalChart.tsx"
click node_flame "https://github.com/gooda/perf_monitor/blob/master/src/components/charts/FlameGraph.tsx"
click node_themeui "https://github.com/gooda/perf_monitor/blob/master/src/components/ui/ThemeToggle.tsx"
click node_theme "https://github.com/gooda/perf_monitor/blob/master/src/stores/themeStore.ts"

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_entry,node_user toneBlue
class node_connection,node_hook,node_ws toneAmber
class node_store,node_theme toneMint
class node_overview,node_process,node_detailed toneRose
class node_metric,node_line,node_multi,node_area,node_bidirectional,node_flame,node_themeui,node_backend toneIndigo
```

## Components

### Dashboard

- [App shell](https://github.com/gooda/perf_monitor/blob/master/src/App.tsx): `src/App.tsx`

### Connection & Ingestion

- [Connection controls](https://github.com/gooda/perf_monitor/blob/master/src/components/panels/ConnectionPanel.tsx): `src/components/panels/ConnectionPanel.tsx`
- [WebSocket hook](https://github.com/gooda/perf_monitor/blob/master/src/hooks/useWebSocket.ts): `src/hooks/useWebSocket.ts`
- [WebSocket service](https://github.com/gooda/perf_monitor/blob/master/src/services/websocket.ts): `src/services/websocket.ts`

### Monitoring State

- [Performance store](https://github.com/gooda/perf_monitor/blob/master/src/stores/perfStore.ts): `src/stores/perfStore.ts`
- [Theme store](https://github.com/gooda/perf_monitor/blob/master/src/stores/themeStore.ts): `src/stores/themeStore.ts`

### Analysis Views

- [System overview](https://github.com/gooda/perf_monitor/blob/master/src/components/panels/OverviewPanel.tsx): `src/components/panels/OverviewPanel.tsx`
- [Process analysis](https://github.com/gooda/perf_monitor/blob/master/src/components/panels/ProcessPanel.tsx): `src/components/panels/ProcessPanel.tsx`
- [Stack analysis](https://github.com/gooda/perf_monitor/blob/master/src/components/panels/DetailedPanel.tsx): `src/components/panels/DetailedPanel.tsx`

### Charts & Theme

- [Metric cards](https://github.com/gooda/perf_monitor/blob/master/src/components/ui/MetricCard.tsx): `src/components/ui/MetricCard.tsx`
- [Line chart](https://github.com/gooda/perf_monitor/blob/master/src/components/charts/LineChart.tsx): `src/components/charts/LineChart.tsx`
- [Multi-line chart](https://github.com/gooda/perf_monitor/blob/master/src/components/charts/MultiLineChart.tsx): `src/components/charts/MultiLineChart.tsx`
- [Stacked area chart](https://github.com/gooda/perf_monitor/blob/master/src/components/charts/StackedAreaChart.tsx): `src/components/charts/StackedAreaChart.tsx`
- [Bidirectional chart](https://github.com/gooda/perf_monitor/blob/master/src/components/charts/BidirectionalChart.tsx): `src/components/charts/BidirectionalChart.tsx`
- [Flame graph](https://github.com/gooda/perf_monitor/blob/master/src/components/charts/FlameGraph.tsx): `src/components/charts/FlameGraph.tsx`
- [Theme toggle](https://github.com/gooda/perf_monitor/blob/master/src/components/ui/ThemeToggle.tsx): `src/components/ui/ThemeToggle.tsx`

### Other components

- **Dashboard user**
- **ios_perf backend**

## Connections

- Dashboard user → App shell: uses
- App shell → Connection controls: renders (evidence: `src/App.tsx`)
- App shell → System overview: selects view (evidence: `src/App.tsx`)
- App shell → Process analysis: selects view (evidence: `src/App.tsx`)
- App shell → Stack analysis: selects view (evidence: `src/App.tsx`)
- App shell → Theme toggle: renders (evidence: `src/App.tsx`)
- Connection controls → WebSocket hook: controls (evidence: `src/components/panels/ConnectionPanel.tsx`)
- WebSocket hook → WebSocket service: calls (evidence: `src/hooks/useWebSocket.ts`)
- WebSocket service → ios_perf backend: exchanges metrics (evidence: `README.md`)
- WebSocket hook → Performance store: updates (evidence: `src/hooks/useWebSocket.ts`)
- System overview → Performance store: reads metrics (evidence: `src/components/panels/OverviewPanel.tsx`)
- Process analysis → Performance store: reads process data (evidence: `src/components/panels/ProcessPanel.tsx`)
- Stack analysis → Performance store: reads stack data (evidence: `src/components/panels/DetailedPanel.tsx`)
- System overview → Metric cards: renders
- System overview → Line chart: renders
- System overview → Multi-line chart: renders
- Process analysis → Metric cards: renders (evidence: `src/components/panels/ProcessPanel.tsx`)
- Process analysis → Stacked area chart: renders (evidence: `src/components/panels/ProcessPanel.tsx`)
- Process analysis → Bidirectional chart: renders (evidence: `src/components/panels/ProcessPanel.tsx`)
- Stack analysis → Flame graph: renders
- Theme toggle → Theme store: updates (evidence: `src/components/ui/ThemeToggle.tsx`)
- App shell → Theme store: initializes (evidence: `src/main.tsx`)
