The PS Trace tool monitors every assembly instruction execution of the CPU (ARMv8). The tool provides insights for online diagnosis, performance debugging and post run data analysis. PS Trace offers granular insight into code execution. During Vitis debug sessions, you can see exactly what the CPU is doing instruction by instruction, not just what the source code says.
You can view and analyze trace data from a number of supported processors:
- Arm® Cortex-A53
- Arm R52
- Arm A78
- Arm R5
- Arm R52
- Arm A72
OpenCSD Setup
OpenCSD is an open source CoreSight Trace Decode library. This library provides an API that facilitates the decode of Arm CoreSight trace streams. The PS Trace functionality uses the OpenCSD library to decode the CoreSight trace data that comes from the Arm processor. To access the trace file, you must first install OpenCSD to employ its library for decoding the trace binary into a human-readable format file. Follow the steps below to install the OpenCSD library.
- Set the 'INSTALL_PATH' environment variable for specifying the
path to install the compiled OpenCSD
files.
export INSTALL_PATH="/path/to/install/" - Clone the OpenCSD GitHub repository to your local
host.
git clone https://github.com/Linaro/OpenCSD.git - Install
OpenCSD.
cd OpenCSD/decoder/build/linux/ make install PREFIX=$INSTALL_PATH - Lastly, set the OpenCSD environment variable for the Vitis tool to use the OpenCSD library. To do this use the
following command before launching Vitis:
export OPENCSD_PATH=$INSTALL_PATH
Performing PS Trace
Step 1: Launch Configuration Setup
Launch the debug configuration (launch.json) for your application. Enable the tracing option and set the trace memory related information.
The following are the items on screen:
- Scratch Address: Starting address in memory for storing the trace binary file.
- Trace Decoded File: Memory length for storing the trace binary file.
- Output File path: Location for storing the trace summary file
generated from the trace binary file by the Vitis tool.Important: This is a ring buffer. Ensure the buffer size is set appropriately; if the trace data exceeds this size, the new data will overwrite the existing buffer contents.
Step 2: Adding breakpoints
PS Trace involves the placement of a trace start and trace start breakpoint. The code section you place these breakpoints around is the section of code to be traced. Confirm the lines of code you want to trace before setting the breakpoints.
Start the debug session and set a trace start breakpoint in the Debug view. To add a trace start breakpoint, right-click the line number containing the first instructions you want to trace in the source code view.
Similarly, to add a trace stop breakpoint, right-click the line number in the source code view where the instructions you want to stop tracing are located.
Click Continue to start the debug session. If the trace start breakpoint is reached, wait for a notification in the bottom-right corner confirming the trace has started. Next, click Continue in the Debug view to trigger the trace.
After hitting the trace stop breakpoint, wait for the notification in the bottom-right corner indicating the generation of the trace summary. Click Open to view the trace file. You can also go to Vitis→PS Trace→Open PS Trace and navigate to the folder you set to store the trace file.
Click Browse in the Set Source Mapping dialog box and navigate to the folder where the ELF file is located.
Click Ok. The system displays the Trace File screen.
In the Trace File view, you can perform operations to analyze the trace report effectively.