Skip to content

Latest commit

 

History

History
93 lines (68 loc) · 4.49 KB

README.md

File metadata and controls

93 lines (68 loc) · 4.49 KB

SOF Top (sof-top)

Hardware-accelerated GTK4 + Cairo real-time Sound Open Firmware (SOF) DSP resource, memory, and task monitor for Linux host systems and remote DUTs (sof_remote_server).

sof-top tries the local SOF host first (reading read-only from Linux SOF DebugFS/SysFS, /proc/asound, or an explicit /dev/sof-dsp0 character device), and when no local device is available, disables the local option in the UI so you can connect to any remote sof_remote_server over SOFZ-compressed TCP.


Features

  • Moving DSP Core Utilization Graph:
    • Rolling 60-second time-series graph of per-core CPU load (Core 0..N in % of DSP clock and KCPS) plus aggregate peak/average load.
    • Per-core summary cards showing clock frequency (MHz), active state, average/peak KCPS, and utilization bars.
  • Moving DSP Memory Utilization Graph (SRAM + DRAM):
    • Rolling 60-second multi-trace time-series graph tracking:
      • HPSRAM (L2 High-Performance SRAM powered banks, e.g., 24 x 128 KB = 3072 KB)
      • LPSRAM (L2 Low-Power SRAM powered banks, e.g., 1 x 64 KB = 64 KB)
      • DRAM (L3 / IMR) (IMR / L3 backing storage, e.g., 16,384 KB budget + .l3_rodata footprint + LLEXT DRAM heaps)
      • DSP Heaps (Combined active allocations across System, Runtime, Module, Shared, Buffer, and LLEXT heaps)
    • Side-by-side capacity gauges for HPSRAM, LPSRAM, DRAM (L3/IMR), and DSP Heaps.
  • Unified DSP Task List with Resources & Status:
    • Consolidates Scheduler Domains (LL / DP), Zephyr RTOS Threads (TEL2), Audio Processing Modules (IPC4 / PMW2), and DAI Gateways into a single filterable, sortable table (Sort: CPU %, Memory KB, Type, Name) showing Task ID, Name/UUID, Type, Core, Status (ACTIVE, READY, RESIDENT, IDLE, GATED), CPU %, KCPS (avg/max), SRAM (KB), DRAM (KB), and Stack/Cycles/XRUN details.

Python & System Dependencies

1. Python Dependencies

sof-top requires Python 3.10+ and the following Python packages (listed in requirements.txt and pyproject.toml):

Python Package Version Purpose
PyGObject >= 3.42.0 Python GObject Introspection bindings (Gtk 4.0, Gdk 4.0, GLib 2.0, Pango 1.0, PangoCairo 1.0)
pycairo >= 1.20.0 Cairo 2D vector graphics bindings for hardware-accelerated custom GTK4 widgets and headless PNG rendering

2. System Packages (Ubuntu / Debian)

sudo apt update
sudo apt install \
    python3 \
    python3-pip \
    python3-gi \
    python3-gi-cairo \
    gir1.2-gtk-4.0 \
    gir1.2-pango-1.0

Usage

sof-top is directly executable (#!/usr/bin/env python3, chmod +x) — no need to prefix python3:

# Auto-connect to local SOF device via read-only DebugFS/SysFS (or prompt for remote host if none present):
./sof-top/sof-top

# Explicitly monitor local host (may need sudo if /sys/kernel/debug is mode 0700):
sudo ./sof-top/sof-top --local

# Connect to a remote DUT running sof_remote_server:
./sof-top/sof-top --host <hostname> --wake

# Connect to an explicit local character device (/dev/sof-dsp0):
./sof-top/sof-top --local /dev/sof-dsp0

# Headless high-DPI PNG snapshot export (for CI or reports):
./sof-top/sof-top --host <hostname> --wake --render-png /tmp/softop_user

# Command-line snapshot / streaming extractor (`sof-top-cli`, no GTK required):
./sof-top/sof-top-cli --list-elements
./sof-top/sof-top-cli --host <hostname> --wake --format json
./sof-top/sof-top-cli --host <hostname> --wake --stream -n 5 -i 200 --format jsonl -e summary,cores,memory.hpsram
./sof-top/sof-top-cli --host <hostname> --wake -e tasks.name,tasks.cpu_pct,tasks.avg_kcps --active-only --format text

Command-Line Options

Option Default Description
-H, --host HOST (none) Remote DUT hostname or IP running sof_remote_server (omit to auto-detect local host)
-p, --port PORT 9998 Remote TCP port for sof_remote_server
-l, --local [DEV] (auto) Local read-only DebugFS/SysFS telemetry, or explicit device path (e.g. /dev/sof-dsp0)
-i, --interval MS 250 Telemetry poll interval in milliseconds
-w, --wake false Hold/wake DSP via PM runtime when polling telemetry (TCP / CDEV only)
--render-png PATH (empty) Render dashboard headlessly to PNG file and exit

License

SPDX-License-Identifier: BSD-3-Clause — see ../LICENSE.