# imacte/yumi architecture

> Architecture diagram of the GitHub repository imacte/yumi, 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/imacte/yumi
- Repository: https://github.com/imacte/yumi

## Overview

yumi is a rooted Android CPU scheduling daemon with a browser-based management UI. The main workflow detects foreground apps and collects CPU, frame, screen, and configuration events; the scheduler selects CLG or FAS behavior and applies frequency policy. The graph retains documented subsystems such as thermal/Doze controls, I/O tuning, and app rules, though some are not visible in sampled implementation excerpts. Dashed links mark documented or plausible integration paths whose exact caller was not shown.

Main entry points: [`src/scheduler/mod.rs`](https://github.com/imacte/yumi/blob/main/src/scheduler/mod.rs) (Scheduler event loop), [`src/main.rs`](https://github.com/imacte/yumi/blob/main/src/main.rs) (yumi daemon), [`src/common.rs`](https://github.com/imacte/yumi/blob/main/src/common.rs) (Daemon event bus), [`src/scheduler/fas/controller.rs`](https://github.com/imacte/yumi/blob/main/src/scheduler/fas/controller.rs) (FAS controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Web management"]
  node_webui["WebUI<br/>[App.vue]"]
  node_ui_views["Management views"]
  node_bridge["KernelSU bridge<br/>[bridge.ts]"]
end

subgraph group_monitor["Monitoring"]
  node_app_detect["Foreground app detection<br/>[app_detect.rs]"]
  node_screen_detect["Screen detection<br/>[screen_detect.rs]"]
  node_cpu_monitor["eBPF CPU monitor<br/>[cpu_monitor.rs]"]
  node_fps_monitor["eBPF FPS monitor<br/>[fps_monitor.rs]"]
  node_ebpf_cpu["CPU probe<br/>[cpu.rs]"]
  node_ebpf_fps["FPS probes<br/>[fps-ring.rs]"]
  node_rules["App rules<br/>[config.rs]"]
end

subgraph group_scheduler["Scheduling"]
  node_scheduler_loop["Scheduler event loop<br/>[mod.rs]"]
  node_mode_sched["Mode scheduling<br/>[scheduler.rs]"]
  node_clg["CPU load governor"]
end

subgraph group_fas["Frame-aware scheduling"]
  node_fas_controller["FAS controller<br/>[controller.rs]"]
  node_frame_pipeline["Frame analysis<br/>[frame_pipeline.rs]"]
  node_pid["PID control<br/>[pid.rs]"]
  node_fps_gears["FPS gear state<br/>[gear_state.rs]"]
  node_policy["Frequency policy"]
  node_fas_config["FAS configuration<br/>[fas_types.rs]"]
end

subgraph group_runtime["Runtime support"]
  node_daemon["yumi daemon<br/>[main.rs]"]
  node_event_bus["Daemon event bus<br/>[common.rs]"]
  node_i18n["Localization<br/>[i18n.rs]"]
  node_logger["Logging<br/>[logger.rs]"]
end

node_user(("Device user"))
node_device[("Android kernel and sysfs")]

node_user -->|"manages"| node_webui
node_webui -.->|"renders"| node_ui_views
node_ui_views -.->|"invokes"| node_bridge
node_bridge -.->|"requests control"| node_daemon
node_daemon -->|"starts"| node_scheduler_loop
node_daemon -->|"starts monitor"| node_app_detect
node_daemon -->|"creates channel"| node_event_bus
node_app_detect -->|"loads and reloads"| node_rules
node_app_detect -->|"sends mode events"| node_event_bus
node_screen_detect -->|"reports screen state"| node_event_bus
node_cpu_monitor -.->|"attaches probe"| node_ebpf_cpu
node_fps_monitor -.->|"attaches probe"| node_ebpf_fps
node_cpu_monitor -->|"sends load events"| node_event_bus
node_fps_monitor -->|"sends frame events"| node_event_bus
node_scheduler_loop -->|"receives events"| node_event_bus
node_scheduler_loop -.->|"dispatches modes"| node_mode_sched
node_mode_sched -->|"uses in non-FAS modes"| node_clg
node_scheduler_loop -.->|"dispatches FAS"| node_fas_controller
node_fas_controller -->|"processes frames"| node_frame_pipeline
node_frame_pipeline -->|"updates control"| node_pid
node_fas_controller -.->|"manages FPS gears"| node_fps_gears
node_fas_controller -->|"uses rules"| node_fas_config
node_fas_controller -->|"applies frequencies"| node_policy
node_clg -->|"adjusts CPU frequency"| node_device
node_policy -->|"writes sysfs"| node_device
node_cpu_monitor -->|"reads kernel events"| node_device
node_fps_monitor -->|"reads render events"| node_device
node_app_detect -->|"detects foreground app"| node_device
node_screen_detect -->|"listens for uevents"| node_device
node_scheduler_loop -.->|"applies thermal and Doze limits"| node_device
node_scheduler_loop -.->|"tunes I/O policy"| node_device
node_daemon -->|"loads language"| node_i18n
node_daemon -->|"initializes logging"| node_logger

click node_webui "https://github.com/imacte/yumi/blob/main/webui/src/App.vue"
click node_ui_views "https://github.com/imacte/yumi/tree/main/webui/src/views"
click node_bridge "https://github.com/imacte/yumi/blob/main/webui/src/utils/bridge.ts"
click node_daemon "https://github.com/imacte/yumi/blob/main/src/main.rs"
click node_event_bus "https://github.com/imacte/yumi/blob/main/src/common.rs"
click node_app_detect "https://github.com/imacte/yumi/blob/main/src/monitor/app_detect.rs"
click node_screen_detect "https://github.com/imacte/yumi/blob/main/src/monitor/screen_detect.rs"
click node_cpu_monitor "https://github.com/imacte/yumi/blob/main/src/monitor/cpu_monitor.rs"
click node_fps_monitor "https://github.com/imacte/yumi/blob/main/src/monitor/fps_monitor.rs"
click node_ebpf_cpu "https://github.com/imacte/yumi/blob/main/yumi-ebpf/src/bin/cpu.rs"
click node_ebpf_fps "https://github.com/imacte/yumi/blob/main/yumi-ebpf/src/bin/fps-ring.rs"
click node_rules "https://github.com/imacte/yumi/blob/main/src/monitor/config.rs"
click node_scheduler_loop "https://github.com/imacte/yumi/blob/main/src/scheduler/mod.rs"
click node_mode_sched "https://github.com/imacte/yumi/blob/main/src/scheduler/scheduler.rs"
click node_clg "https://github.com/imacte/yumi/blob/main/src/scheduler/cpu_load_governor.rs"
click node_fas_controller "https://github.com/imacte/yumi/blob/main/src/scheduler/fas/controller.rs"
click node_frame_pipeline "https://github.com/imacte/yumi/blob/main/src/scheduler/fas/frame_pipeline.rs"
click node_pid "https://github.com/imacte/yumi/blob/main/src/scheduler/fas/pid.rs"
click node_fps_gears "https://github.com/imacte/yumi/blob/main/src/scheduler/fas/gear_state.rs"
click node_policy "https://github.com/imacte/yumi/blob/main/src/scheduler/fas/policy_controller.rs"
click node_fas_config "https://github.com/imacte/yumi/blob/main/src/fas_types.rs"
click node_i18n "https://github.com/imacte/yumi/blob/main/src/i18n.rs"
click node_logger "https://github.com/imacte/yumi/blob/main/src/logger.rs"

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_webui,node_ui_views,node_bridge,node_user toneBlue
class node_app_detect,node_screen_detect,node_cpu_monitor,node_fps_monitor,node_ebpf_cpu,node_ebpf_fps,node_rules,node_device toneAmber
class node_scheduler_loop,node_mode_sched,node_clg toneMint
class node_fas_controller,node_frame_pipeline,node_pid,node_fps_gears,node_policy,node_fas_config toneRose
class node_daemon,node_event_bus,node_i18n,node_logger toneIndigo
```

## Components

### Web management

- [WebUI](https://github.com/imacte/yumi/blob/main/webui/src/App.vue): `webui/src/App.vue`
- [Management views](https://github.com/imacte/yumi/tree/main/webui/src/views): `webui/src/views`
- [KernelSU bridge](https://github.com/imacte/yumi/blob/main/webui/src/utils/bridge.ts): `webui/src/utils/bridge.ts`

### Monitoring

- [Foreground app detection](https://github.com/imacte/yumi/blob/main/src/monitor/app_detect.rs): `src/monitor/app_detect.rs`
- [Screen detection](https://github.com/imacte/yumi/blob/main/src/monitor/screen_detect.rs): `src/monitor/screen_detect.rs`
- [eBPF CPU monitor](https://github.com/imacte/yumi/blob/main/src/monitor/cpu_monitor.rs): `src/monitor/cpu_monitor.rs`
- [eBPF FPS monitor](https://github.com/imacte/yumi/blob/main/src/monitor/fps_monitor.rs): `src/monitor/fps_monitor.rs`
- [CPU probe](https://github.com/imacte/yumi/blob/main/yumi-ebpf/src/bin/cpu.rs): `yumi-ebpf/src/bin/cpu.rs`
- [FPS probes](https://github.com/imacte/yumi/blob/main/yumi-ebpf/src/bin/fps-ring.rs): `yumi-ebpf/src/bin/fps-ring.rs`
- [App rules](https://github.com/imacte/yumi/blob/main/src/monitor/config.rs): `src/monitor/config.rs`

### Scheduling

- [Scheduler event loop](https://github.com/imacte/yumi/blob/main/src/scheduler/mod.rs): `src/scheduler/mod.rs`
- [Mode scheduling](https://github.com/imacte/yumi/blob/main/src/scheduler/scheduler.rs): `src/scheduler/scheduler.rs`
- [CPU load governor](https://github.com/imacte/yumi/blob/main/src/scheduler/cpu_load_governor.rs): `src/scheduler/cpu_load_governor.rs`

### Frame-aware scheduling

- [FAS controller](https://github.com/imacte/yumi/blob/main/src/scheduler/fas/controller.rs): `src/scheduler/fas/controller.rs`
- [Frame analysis](https://github.com/imacte/yumi/blob/main/src/scheduler/fas/frame_pipeline.rs): `src/scheduler/fas/frame_pipeline.rs`
- [PID control](https://github.com/imacte/yumi/blob/main/src/scheduler/fas/pid.rs): `src/scheduler/fas/pid.rs`
- [FPS gear state](https://github.com/imacte/yumi/blob/main/src/scheduler/fas/gear_state.rs): `src/scheduler/fas/gear_state.rs`
- [Frequency policy](https://github.com/imacte/yumi/blob/main/src/scheduler/fas/policy_controller.rs): `src/scheduler/fas/policy_controller.rs`
- [FAS configuration](https://github.com/imacte/yumi/blob/main/src/fas_types.rs): `src/fas_types.rs`

### Runtime support

- [yumi daemon](https://github.com/imacte/yumi/blob/main/src/main.rs): `src/main.rs`
- [Daemon event bus](https://github.com/imacte/yumi/blob/main/src/common.rs): `src/common.rs`
- [Localization](https://github.com/imacte/yumi/blob/main/src/i18n.rs): `src/i18n.rs`
- [Logging](https://github.com/imacte/yumi/blob/main/src/logger.rs): `src/logger.rs`

### Other components

- **Device user**
- **Android kernel and sysfs**

## Connections

- Device user → WebUI: manages
- WebUI → Management views: renders
- Management views → KernelSU bridge: invokes
- KernelSU bridge → yumi daemon: requests control
- yumi daemon → Scheduler event loop: starts (evidence: `src/main.rs`)
- yumi daemon → Foreground app detection: starts monitor
- yumi daemon → Daemon event bus: creates channel (evidence: `src/main.rs`)
- Foreground app detection → App rules: loads and reloads (evidence: `src/monitor/app_detect.rs`)
- Foreground app detection → Daemon event bus: sends mode events (evidence: `src/monitor/app_detect.rs`)
- Screen detection → Daemon event bus: reports screen state
- eBPF CPU monitor → CPU probe: attaches probe
- eBPF FPS monitor → FPS probes: attaches probe
- eBPF CPU monitor → Daemon event bus: sends load events
- eBPF FPS monitor → Daemon event bus: sends frame events
- Scheduler event loop → Daemon event bus: receives events (evidence: `src/scheduler/mod.rs`)
- Scheduler event loop → Mode scheduling: dispatches modes (evidence: `src/scheduler/mod.rs`)
- Mode scheduling → CPU load governor: uses in non-FAS modes
- Scheduler event loop → FAS controller: dispatches FAS
- FAS controller → Frame analysis: processes frames (evidence: `src/scheduler/fas/controller.rs`)
- Frame analysis → PID control: updates control (evidence: `src/scheduler/fas/frame_pipeline.rs`)
- FAS controller → FPS gear state: manages FPS gears
- FAS controller → FAS configuration: uses rules (evidence: `src/scheduler/fas/controller.rs`)
- FAS controller → Frequency policy: applies frequencies (evidence: `src/scheduler/fas/policy_controller.rs`)
- CPU load governor → Android kernel and sysfs: adjusts CPU frequency
- Frequency policy → Android kernel and sysfs: writes sysfs
- eBPF CPU monitor → Android kernel and sysfs: reads kernel events
- eBPF FPS monitor → Android kernel and sysfs: reads render events
- Foreground app detection → Android kernel and sysfs: detects foreground app
- Screen detection → Android kernel and sysfs: listens for uevents
- Scheduler event loop → Android kernel and sysfs: applies thermal and Doze limits
- Scheduler event loop → Android kernel and sysfs: tunes I/O policy
- yumi daemon → Localization: loads language (evidence: `src/main.rs`)
- yumi daemon → Logging: initializes logging (evidence: `src/main.rs`)
