System Info Service
Relevant source files
The following files were used as context for generating this wiki page:
The System Info Service is a centralized backend service within FlxOS responsible for aggregating and reporting hardware and software telemetry. It serves as the primary data provider for resource monitoring, exposing critical metrics such as CPU load, memory utilization (Internal Heap and PSRAM), storage partition status, and network connectivity details to both the graphical user interface (GUI) and the command-line interface (CLI).
As a core component of the main/core/services/ layer, the service abstracts complex ESP-IDF system calls into structured data models. It is utilized by the SystemInfoApp for real-time visualization and the CliService for remote debugging and monitoring via terminal.
Sources: main/core/services/system_info/SystemInfoService.cpp, main/core/README.md, README.md:31-45
Architecture and Data Flow
The System Info Service operates as a singleton, providing a unified API to various system consumers. It interacts directly with the ESP-IDF hardware abstraction layers and FreeRTOS kernels to retrieve low-level metrics.
Service Interactions
The following diagram illustrates how the System Info Service interacts with system managers and various interfaces:
The service acts as an intermediary, transforming raw hardware data into structured types like SystemStats, MemoryStats, and TaskInfo.
Sources: main/core/services/system_info/SystemInfoService.cpp:27-40, main/core/apps/system_info/SystemInfoApp.cpp:218-230, main/core/services/cli/CliService.cpp:64-75
Key Modules and Metrics
1. System and Hardware Telemetry
The service retrieves chip-specific information, including model, revision, and core count. It also tracks system uptime and boot reasons.
| Field | Data Source / Logic | Description |
|---|---|---|
| Chip Model | getChipModel() | Identifies ESP32 variant (ESP32, S2, S3, C3, etc.) |
| Uptime | esp_timer_get_time() | Total system run time in seconds |
| Boot Reason | esp_reset_reason() | Identifies if boot was via PowerOn, WDT, or Software |
| CPU Frequency | CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ | Reports configured clock speed in MHz |
Sources: main/core/services/system_info/SystemInfoService.cpp:94-135, main/core/services/system_info/SystemInfoService.cpp:394-416
2. Memory Management (Heap and PSRAM)
Metrics are gathered for both internal SRAM and external SPIRAM (PSRAM). The service calculates usage percentages and identifies the largest free blocks to monitor fragmentation.
3. Task and CPU Load Monitoring
The service utilizes uxTaskGetSystemState to provide detailed information about every active FreeRTOS task. It calculates CPU usage per task by measuring the delta in task runtime relative to total system runtime.
- Task Metadata: Includes Name, State (RUN, RDY, BLK, SUS), Priority, and Stack High Water Mark.
- CPU Calculation: CPU usage is normalized by the number of cores to ensure a task fully utilizing one core represents 100% load on that specific core.
Sources: main/core/services/system_info/SystemInfoService.cpp:302-368, main/core/apps/system_info/SystemInfoApp.cpp:261-276
4. Storage and Connectivity
The service monitors the Virtual File System (VFS) and WiFi stack:
- Storage: Reports total and free bytes for the
/systemand/datapartitions. - WiFi: Provides SSID, IP address, MAC address, and RSSI (signal strength) mapped to qualitative values (Excellent, Good, Fair, Weak).
Sources: main/core/services/system_info/SystemInfoService.cpp:202-221, main/core/services/system_info/SystemInfoService.cpp:263-294
Battery Monitoring Subsystem
When CONFIG_FLXOS_BATTERY_ENABLED is defined, the service initializes an ADC (Analog-to-Digital Converter) to monitor battery voltage. It supports curve-fitting calibration to provide an accurate percentage based on configurable min/max voltage thresholds.
CLI Integration
The CliService registers several commands that directly invoke the SystemInfoService to output diagnostics to the serial terminal.
| Command | Service Method Invoked | Output Description |
|---|---|---|
sysinfo | getSystemStats() | General hardware/software overview |
tasks | getTaskList() | Table of all FreeRTOS tasks and CPU% |
storage | getStorageStats() | Partition usage for System and Data |
heap | getMemoryStats() | Detailed heap and fragmentation info |
Sources: main/core/services/cli/CliService.cpp:64-150, main/core/services/cli/CliService.cpp:455-465
Conclusion
The System Info Service is a critical infrastructure component of FlxOS, providing the necessary telemetry for system health monitoring. By centralizing hardware data retrieval into a single service, FlxOS ensures consistent reporting across its graphical and terminal interfaces, facilitating both user-facing resource management and developer-level debugging.
Sources: ROADMAP.md:1.5, main/core/apps/system_info/SystemInfoApp.cpp