Tracing Real-Time Applications
Tracing records system events related to CPU scheduling and power management, such as context switches, task migrations, CPU frequency changes, and transitions into or out of idle states. Although tracing does not capture function calls within your application, it provides detailed insight into system-level execution flow and timing. This information is essential for debugging scheduling behavior, analyzing task performance, and validating control logic in real-time or multi-core environments.
Simulink® Real-Time™ enables you to generate tracer data for an application running on the target computer and download the data to the host computer as a text file. This file contains detailed event log.
Generate Tracer Data
Follow these steps to generate and download tracer data for a real-time application:
Create and deploy a real-time application on the target computer.
Start the tracer. You must start the tracer before you start the application.
startTracer(tg);
Start the application and tune the parameters as needed.
startApplication(tg);
Stop the application.
When you stop the application, the tracer stops. To continue running the application and stop only the tracer, usestop(tg);
stopTracer(tg)instead.Download the tracer data.
getTracerData(tg);
Simulink
Real-Time downloads the tracer data for the application and saves it as
ftrace_ in
the current MATLAB path, where app_name.txtapp_name is the
real-time application name.
Use the slrtPerformanceAnalyzer function to view the tracer
data.
Applications of Tracer Data
Tracer data contains a chronological log of system and application events such as system calls, context switches, and interrupts from a tracing session for an application running on the target computer.
Key applications include:
Identifying why requests or tasks take longer than expected
Detecting slow system calls and measure their duration
Analyzing thread synchronization issues and deadlocks
Detecting frequent or inefficient system calls causing performance degradation
Examining context switches, thread migrations, and CPU affinity
Tracing the exact sequence of events leading to an error or slowdown
See Also
Target | getTracerData | getTracerStatus | startTracer | slrtPerformanceAnalyzer