From ad532419fb77dd65bf32e4cc97534b9de5cea4a6 Mon Sep 17 00:00:00 2001 From: Martino Ferrari Date: Wed, 25 Feb 2026 21:20:06 +0100 Subject: [PATCH] working again --- Headers/DebugService.h | 1 + SPECS.md | 69 ++++++++++++++++++++++++------------------ specs.md | 41 ------------------------- 3 files changed, 41 insertions(+), 70 deletions(-) delete mode 100644 specs.md diff --git a/Headers/DebugService.h b/Headers/DebugService.h index d6300df..7c538e5 100644 --- a/Headers/DebugService.h +++ b/Headers/DebugService.h @@ -57,6 +57,7 @@ public: uint32 TraceSignal(const char8* name, bool enable, uint32 decimation = 1); void Discover(BasicTCPSocket *client); void InfoNode(const char8* path, BasicTCPSocket *client); + void ListNodes(const char8* path, BasicTCPSocket *client); private: void HandleCommand(StreamString cmd, BasicTCPSocket *client); diff --git a/SPECS.md b/SPECS.md index 9589bd9..b890205 100644 --- a/SPECS.md +++ b/SPECS.md @@ -1,50 +1,61 @@ # MARTe2 Debug Suite Specifications -## 1. Goal -Implement a "Zero-Code-Change" observability layer for the MARTe2 real-time framework, providing live telemetry, signal forcing, and execution control without modifying existing application source code. +**Version:** 1.2 +**Status:** Active / Implemented -## 2. Requirements -### 2.1 Functional Requirements (FR) -- **FR-01 (Discovery):** Discover the full MARTe2 object hierarchy at runtime. -- **FR-02 (Telemetry):** Stream high-frequency signal data (verified up to 100Hz) to a remote client. +## 1. Executive Summary +This project implements a "Zero-Code-Change" observability and debugging layer for the MARTe2 real-time framework. The system allows developers to Trace, Force, and Monitor any signal in a running MARTe2 application without modifying existing source code. + +## 2. System Architecture +- **The Universal Debug Service (C++ Core):** A singleton MARTe2 Object that patches the registry and manages communication. +- **The Broker Injection Layer (C++ Templates):** Templated wrappers that intercept `Execute()` and `Init()` calls for tracing, forcing, and execution control. +- **The Remote Analyser (Rust/egui):** A high-performance, multi-threaded GUI for visualization and control. +- **Network Stack:** + - **Port 8080 (TCP):** Commands and Metadata. + - **Port 8081 (UDP):** High-Speed Telemetry for Oscilloscope. + - **Port 8082 (TCP):** Independent Real-Time Log Stream via `TcpLogger`. + +## 3. Requirements + +### 3.1 Functional Requirements (FR) +- **FR-01 (Discovery):** Discover the full MARTe2 object hierarchy at runtime. The GUI client SHALL request the full application tree upon connection and display it in a hierarchical tree view. +- **FR-02 (Telemetry):** Stream high-frequency signal data (verified up to 100Hz+) to a remote client via UDP. - **FR-03 (Forcing):** Allow manual override of signal values in memory during execution. -- **FR-04 (Logs):** Stream global framework logs to a dedicated terminal via a standalone `TcpLogger` service. +- **FR-04 (Logs):** Stream global framework logs to a dedicated terminal/client via a standalone `TcpLogger` service. - **FR-05 (Log Filtering):** The client must support filtering logs by type (Debug, Information, Warning, FatalError) and by content using regular expressions. -- **FR-06 (Execution & UI):** - - Provide a native GUI for visualization. - - Support Pause/Resume of real-time execution threads via scheduler injection. -- **FR-07 (Session Management):** - - The top panel must provide a "Disconnect" button to close active network streams. - - Support runtime re-configuration and "Apply & Reconnect" logic. -- **FR-08 (Decoupled Tracing):** - Clicking `trace` activates telemetry; data is buffered and shown as a "Last Value" in the sidebar, but not plotted until manually assigned. -- **FR-08 (Advanced Plotting):** +- **FR-06 (Execution Control):** Provide a mechanism to pause and resume the execution of all patched real-time threads (via Brokers), allowing for static inspection of the system state. +- **FR-07 (Session Management):** Support runtime re-configuration and "Apply & Reconnect" logic. The GUI provides a "Disconnect" button to close active network streams. +- **FR-08 (Decoupled Tracing):** Tracing activates telemetry; data is buffered and shown as a "Last Value" in the sidebar, but not plotted until manually assigned. +- **FR-09 (Advanced Plotting):** - Support multiple plot panels with perfectly synchronized time (X) axes. - Drag-and-drop signals from the traced list into specific plots. - - Automatic distinct color assignment for each signal added to a plot. - Plot modes: Standard (Time Series) and Logic Analyzer (Stacked rows). - Signal transformations: Gain, offset, units, and custom labels. - - Visual styling: Deep customization of colors, line styles (Solid, Dashed, etc.), and marker shapes (Circle, Square, etc.). -- **FR-09 (Navigation):** +- **FR-10 (Navigation & Scope):** - Context menus for resetting zoom (X, Y, or both). - - "Fit to View" functionality that automatically scales both axes to encompass all available buffered data points. -- **FR-10 (Scope Mode):** + - "Fit to View" functionality that automatically scales both axes. - High-performance oscilloscope mode with configurable time windows (10ms to 10s). - - Global synchronization of time axes across all plot panels. - - Support for Free-run and Triggered acquisition (Single/Continuous, rising/falling edges). -- **FR-11 (Data Recording):** - - Record any traced signal to disk in Parquet format. - - Native file dialog for destination selection. - - Visual recording indicator in the GUI. + - Triggered acquisition (Single/Continuous, rising/falling edges). +- **FR-11 (Data Recording):** Record any traced signal to disk in Parquet format with a visual recording indicator in the GUI. -### 2.2 Technical Constraints (TC) +### 3.2 Technical Constraints (TC) - **TC-01:** No modifications allowed to the MARTe2 core library or component source code. - **TC-02:** Instrumentation must use Runtime Class Registry Patching. - **TC-03:** Real-time threads must remain lock-free; use `FastPollingMutexSem` or atomic operations for synchronization. - **TC-04:** Telemetry must be delivered via UDP to minimize impact on real-time jitter. -## 3. Performance Metrics +## 4. Performance Metrics - **Latency:** Telemetry dispatch overhead < 5 microseconds per signal. - **Throughput:** Support for 100Hz+ sampling rates with zero packet loss on local networks. - **Scalability:** Handle up to 4096 unique signals and 16 simultaneous client connections. - **Code Quality:** Maintain a minimum of **85% code coverage** across all core service and broker logic. + +## 5. Communication Protocol (Port 8080) +- **LS [Path]:** List nodes at the specified path. +- **TREE:** Returns a full recursive JSON structure representing the entire application tree. +- **INFO [Path]:** Returns detailed metadata for a specific node or signal. +- **PAUSE / RESUME:** Global execution control. +- **TRACE <1/0> [Decimation]:** Enable/disable telemetry for a signal. +- **FORCE :** Persistent signal override. +- **UNFORCE :** Remove override. +- **LOG :** Streaming format used on Port 8082. diff --git a/specs.md b/specs.md deleted file mode 100644 index f3a0f36..0000000 --- a/specs.md +++ /dev/null @@ -1,41 +0,0 @@ -Project Specification: MARTe2 Universal Observability & Debugging Suite - -Version: 1.1 - -Date: 2023-10-27 - -Status: Active / Implemented - -1. Executive Summary - -This project implements a "Zero-Code-Change" observability and debugging layer for the MARTe2 real-time framework. The system allows developers to Trace, Force, and Monitor any signal in a running MARTe2 application without modifying existing source code. - -2. System Architecture - -- The Universal Debug Service (C++ Core): A singleton MARTe2 Object that patches the registry and manages communication. -- The Broker Injection Layer (C++ Templates): Templated wrappers that intercept Copy() calls for tracing, forcing, and execution control. -- The Remote Analyser (Rust/egui): A high-performance, multi-threaded GUI for visualization and control. - -3. Functional Requirements - -3.1 Execution Control -- REQ-25: Execution Control (Pause/Resume): The system SHALL provide a mechanism to pause and resume the execution of all patched real-time threads (via Brokers), allowing for static inspection of the system state. - -3.2 Discovery -- REQ-24: Tree Exploration: The GUI client SHALL request the full application tree upon connection and display it in a hierarchical tree view. -- TREE Command: Returns a recursive JSON structure representing the entire application tree, including signal metadata (Type, Dimensions, Elements). - -3.3 Multi-Threaded Client (REQ-23) -- Port 8080 (TCP): Commands and Metadata. -- Port 8082 (TCP): Independent Real-Time Log Stream. -- Port 8081 (UDP): High-Speed Telemetry for Oscilloscope. - -4. Communication Protocol - -- LS [Path]: List nodes. -- TREE: Full recursive JSON application map. -- PAUSE / RESUME: Execution control. -- TRACE <1/0> [Decimation]: Telemetry control. -- FORCE : Persistent signal override. -- UNFORCE : Remove override. -- LOG : Port 8082 streaming format.