CP Trace use case APIs provide the ability to perform system (SoC) level bandwidth, latency and event profiling. Data is captured either by seperate hardware units (Embedded Trace Buffers, called as ETB) and then decoded offline or captured using external emulators (XDS560PRO or XDS560V2) and decoded using CCS.
The CP trace setup can be done either via CCS or via 'C' code using the ctools use case library. This page describes the instructions for implementing CP trace features via 'C' functions. The CTOOLS CP Tracer library provides APIs to implement the following use-case scenarios:
- System Latency Profiling: Captures latency of data paths from all system masters to the slave (or) slaves associated with either one or multiple CP Tracers. Please, follow the below steps to implement this use-case:
- System Bandwidth Profiling: Captures bandwidth of data paths from all system masters to the slave (or) slaves associated with either one or multiple CP Tracers. Please, follow the below steps to implement this use-case:
- Master Bandwidth Profiling: The bandwidth of data paths from two different group of masters to the slave associated with the CP Tracer is measured and compared.
- The following statistics are captured in this use-case:
- Slave Bus Bandwidth (bytes per second) utilized by master group 0
- Slave Bus Bandwidth (bytes per second) utilized by master group 1
- Average Access Size of slave transactions (for both the master groups)
- Bus Utilization (transactions per second) (for both the master groups)
- Bus Contention Percentage (for both the master groups)
- Minimum Average Latency (for both the master groups)
- Please, follow the below steps to implement this use-case:
- Total Bandwidth Profiling: The bandwidth of data paths from a group of masters to the slave associated with the CP Tracer is compared with the total bandwidth from all masters to the slave.
- The following statistics are captured in this use-case:
- Percentage of total slave activity utilized by selected group of masters
- Slave Bus Bandwidth (bytes per second) utilized by the selected group of masters
- Average Access Size of slave transactions (for all system masters)
- Bus Utilization (transactions per second) (for all system masters)
- Bus Contention Percentage (for all system masters)
- Minimum Average Latency (for all system masters)
- Please, follow the below steps to implement this use-case:
- New Request Event Capture: Based on the slave to be monitored, the associated CP Tracer is configured to capture new request transactions accepted by the slave. The required transactions can be captured by filtering based on Master ID or address range.
- The following statistics are captured for every new request event:
- Master ID which initiated this particular transaction
- Bus Transaction ID
- Read/Write Transaction
- 10 bits of the address (Address export mask selects, which particular 10 bits to export)
- Please, follow the below steps to implement this use-case:
The CP tracer messages (system trace) can be exported out for analysis in 3 ways:
- System ETB drain using CPU (capture only 32KB (SYS ETB size in keystone devices) of system trace data)
- ctools_etb_init(CTOOLS_DRAIN_ETB_CPU, &etb_config, CTOOLS_SYS_ETB) - Initialize the SYS ETB
- ctools_systemtrace_init() - Initialize System Trace and allocate the required resources
- As shown above, do all the steps pertaining to the required CP Tracer use case, that needs to be implemented.
- ctools_etb_cpu_drain(data_ptr, size_in, &size_out, &wrap_flag, CTOOLS_SYS_ETB) - Drain ETB to specified system memory location. The ETB is disabled after the drain is complete.
- ctools_systemtrace_shutdown() - free up resources initialized/utilized
- Please Note: The System ETB does not support Stop On Full mode and an error will be returned, if the user tries to configure the SYS ETB in stop on full mode. Please, use external emulator like XDS560 PRO or XDS560V2, if stop on full mode of operation is required.
- System ETB drain using EDMA (ETB extension to capture more than 32KB (SYS ETB size in keystone devices))
- ctools_etb_init(CTOOLS_DRAIN_ETB_EDMA, &etb_config, CTOOLS_SYS_ETB) - Initialize the SYS ETB
- ctools_edma_resrc_get (&num_params, &num_channels) - get the resource requirement for the EDMA params and channels
- ctools_systemtrace_init() - Initialize System Trace and allocate the required resources
- As shown above, do all the steps pertaining to the required CP Tracer use case, that needs to be implemented.
- ctools_etb_edma_drain(pct_res_ptr, CTOOLS_SYS_ETB) - Returns the system trace information in the return structure if EDMA is used a drain for ETB. The ETB is disabled after the drain is complete.
- ctools_systemtrace_shutdown() - free up resources initialized/utilized
- Please Note: The System ETB extension with EDMA does not support Stop On Full mode and an error will be returned, if the user tries to configure the SYS ETB extension with EDMA in stop on full mode. Please, use external emulator like XDS560 PRO or XDS560V2, if stop on full mode of operation is required.
- External Emulator like XDS560 PRO or XDS560V2
-
For more details and examples, Please refer to the following Wiki page: http://processors.wiki.ti.com/index.php/CToolsLib_Article#CPTLib