The CPU load can be calculated based on trace information. Therefore, either off-chip or on-chip trace is required.
Configuration
1) Enable OS-aware debugging
Load the appropriate OS awareness or ORTI file. Please refer to the TRACE32 manual for your target operating system (e.g. rtos_freertos.pdf for FreeRTOS or rtos_orti.pdf for AUTOSAR CP).
TASK.ORTI < my_orti_file >TASK.CONFIG ~~/demo/arm/kernel/freertos/freertos.t322) Record task switches in the trace
Task switches must be recorded to allow CPU load calculation. Refer to the TRACE32 manual of your target OS for details.
Break.SetTaskMagic /Write /TraceDataCPU Load Calculation
The CPU load is calculated as the percentage of time the CPU is not executing the idle task. Therefore, the idle task(s) must be identified and grouped accordingly.
1. Create a task group for the idle task
GROUP.CreateTASK "<name>" "<my_idle_task>" /MERGEExample:
GROUP.CreateTASK "idle" "NO_TASK" /MERGE2. Optionally merge all other tasks (if they should not be distinguished in the chart):
GROUP.COLOR "other" MAROON
GROUP.MERGE "other"CPU Load Visualization
Trace.PROfileChart.TASK
The TRACE32 command Trace.PROfileChart.TASK provides a graphical representation of the task-related trace statistics, making load peaks and idle phases easy to identify.
MIPS.PROfileChart.TASK
MIPS.PROfileChart.TASK displays the instruction execution rate over time graphically
Trace.PROfileSTATistic.TASK
Trace.PROfileSTATistic.TASK offers a numerical view of CPU load over defined time intervals, example:
Trace.PROfileSTATistic.TASK /InterVal 1sNote: Using the SNOOPer (Without Trace)
If neither off-chip nor on-chip trace is available, the SNOOPer can be used to periodically sample the currently running task.
Please note that this method provides less accurate results compared to trace-based analysis, as it relies on periodic sampling. Additionally, the target processor must support runtime memory access.
Example:
SNOOPer.SELect %Long TASK.CONFIG(magic)
SNOOPer.Arm
WAIT 5.s
SNOOPer.Off
GROUP.CreateTASK "idle" "NO_TASK" /MERGE
GROUP.COLOR "other" MAROON
GROUP.MERGE "other"
SNOOPer.PROfileChart.TASK
Add a comment