NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.
OMX Using System Analyzer For Media Controller Analysis
Contents
Introduction[edit]
System Analyzer is a visualization and analysis tool available in CCS that provides visibility into the application, OS and hardware across the system at any given time. It provides visualization of software and hardware instrumentation from multiple cores correlated to a global timeline. To know more about System Analyzer and how to install it, see Multicore_System_Analyzer
This article assumes that CCS with System Analyzer has already been installed on the host and therefore is focussed on covering the following aspects:
- Setting up & Running System Analyzer Session
- Analyzing and Interpreting data using System Analyzer
Throughout this document there will be commands spelled out to execute. Some are to be executed on the Linux development host, some on the Linux target and some on the u-boot (bootloader) prompt. They are distinguished by different command prompts as follows:
host $ <this command is to be executed on the host> target # <this command is to be executed on the target> u-boot :> <this command is to be executed on the u-boot prompt>
Note! In order to use CCS with System Analyzer, the target need not be connected to the host (which has CCS installed) using a JTAG, as the host communicates with target via Ethernet.
Version Information and Compatibility[edit]
Note! These instructions have been updated for EZSDK 5.03.00.09 which uses UIA version 1.00.03.25 and CCS version 5.1 M8. These instructions are applicable to DM816x and DM814x devices. However, in order to keep the article generic DM81xx has been used to refer to both the devices
Note! CCS version 5.1 M8 comes along with System Analyzer v1.0. No separate installation is required on top of CCS
Note! The term MCSA stands for Multi-Core System Analyzer means the same as SA System Analyzer. The documentation refers to both of these names interchangeably.
Setting up & Running System Analyzer Session[edit]
Firmware and XML Files needed for System Analyzer[edit]
The following files are available on the host as part of the EZSDK installation under /board-support/prebuilt-images/dm81xx-firmware_xx_xx_xx_xx/. These files are required to set up a System Analyzer session. Ensure that these files are also available on the host where CCS is installed.
dm816x_hdvicp.xem3: VIDEO Media Controller OMX Firmware dm816x_hdvicp.rta.xml: XML files associated with the VIDEO Media Controller OMX Firmware dm816x_hdvicp.uia.xml: XML files associated with the VIDEO Media Controller OMX Firmware
dm816x_hdvpss.xem3: VPSS Media Controller OMX Firmware dm816x_hdvpss.rta.xml: XML files associated with the VIDEO Media Controller OMX Firmware dm816x_hdvpss.uia.xml: XML files associated with the VIDEO Media Controller OMX Firmware
Note! There is a 1 to 1 correspondence between the Media Controller OMX Firmware and the associated XML files.
In case, users have access to the OMX Firmware source code and have re-built the firmware, then:
The OMX firmware (*.xem3) for VIDEO and VPSS Media Controller will be available at:
/component-sources/omx-ti81xx-src_xx_xx_xx_xx/bin/dm81xxbm/bin/ti81xx- evm
The *.rta.xml and *.uia.xml files for VIDEO Media Controller will be available at:
/component-sources/omx-ti81xx-src_xx_xx_xx_xx/bin/dm81xxbm/obj/ti81xx- evm/m3video/whole_program_debug/dm81xxbm_configuro/package/cfg/
The *.rta.xml and *.uia.xml files for VPSS Media Controller will be available at:
/component-sources/omx-ti81xx-src_xx_xx_xx_xx/bin/dm81xxbm/obj/ti81xx- evm/m3vpss/whole_program_debug/dm81xxbm_configuro/package/cfg/
Note! The .xem3, .uia.xml and .rta.xml should be renamed appropriately to match with the names under /board-support/prebuilt-images/dm81xx-firmware_xx_xx_xx_xx/ as shown above
Running A8 application[edit]
Let us take the example of capture_encode in EZSDK to demonstrate the changes required to use System Analyzer.
- As mentioned in OMX_Viewing_Media_Controller_Traces, enableAnalysisEvents field in the ConfigureUIA structure needs to be set to 1 to enable logging of analysis events in the OMX Firmware.
In the file component-sources/omx_xx_xx_xx_xx/examples/ti/omx/demos/capture_encode/src/main.c, around line 144 change from:
uiaCfg.enableAnalysisEvents = 0;
to as shown below:
uiaCfg.enableAnalysisEvents = 1;
- Then, re-build the omx examples. The following command may be used from the EZSDK installation directory
make omx
The re-built capture_encode A8 application will be available under:
component-sources/omx_xx_xx_xx_xx/bin/capture_encode/bin/ti81xx-evm/capture_encode_a8host_debug.xv5T
- Over-write the capture_encode application in the target filesystem with this newly generated executable.
- Note down the IP address of the target EVM. This will be required while setting up a System Analyzer session.
- Run the capture_encode executable on the target filesystem. It is recommmended that the A8 side application be run for a longer duration in order to enable the user to set up and run System Analyzer session on the host.
./capture_encode_a8host_debug.xv5T -o sample.264 -m 1080p -f 60 -b 1000000 -d 0 -n 100000
Setting up a System Analyzer Session[edit]
This section lists the steps to set up a System Analyzer session in CCS.
- Launch CCS
- Create a UIA Config. For this, go to Tools->System Analyzer->UIA Config as shown below. A dialog Box titled UIA Config should pop up.
(click on the picture to enlarge)
- Right-click in the Dialog Box area and choose "Add an Event Transport". This is the port used for moving logs from the target to the host.
(click on the picture to enlarge)
- In the "Add an Event Connection" dialog, provide details about the transport you want to use. Different target connections require different transports. The values for the fields should be:
Transport type: UDP Address: <IP address of the target board> Port Number: 1235
Click OK in the dialog box.
(click on the picture to enlarge)
- Right-click in the Dialog Box area and choose "Add a Control & Status Transport". This port is used for sending and receiving commands.
(click on the picture to enlarge)
- As in a previous step, in the Add a Control and Status dialog, provide details about the transport you want to use. Different target connections require different transports. The values for the fields should be:
Transport type: TCP/IP Address: <IP address of the target board> Port Number: 1234
Click OK in the dialog box.
(click on the picture to enlarge)
- Right-click in the Dialog Box area and choose "Add an endpoint". This should be used to add 2 end-points. End points here represent the Media Controllers to monitor in System Analyzer. There one end-point needs to added for VIDEO Media Contoller and another for VPSS Media Controller. The steps shown below are for the VIDEO Media Controller. Similar steps should be followed for the VPSS Media Controller. In the Add an endpoint dialog box, set the following:
Name:VIDEO Endpoint Address:1 .outfile: <Chose the dm81xx_hdvicp.xem3 here>
After setting these, CCS will attemp to auto detect the .uia.xml and .rta.xml files which it will not be able to find as they get renamed in the EZSDK build system. After trying, it will give an error which can be ignored. Now choose the following:
.uia.xml file: dm81xx_hdvicp.uia.xml .rta.xml file: dm81xx_hdvicp.rta.xml Clock Freq : 250 <for DM816x>, 200 <for DM814x>
Press OK.
(click on the picture to enlarge)
(click on the picture to enlarge)
- Right-click in the Dialog Box area and choose "Add an endpoint". In the Add an endpoint dialog box, set the following (this is similar to the previous step):
Name:VPSS Endpoint Address:2 .outfile: <Chose the dm81xx_hdvpss.xem3 here>
After setting these, CCS will attempt to auto detect the .uia.xml and .rta.xml files which it will not be able to find as they get renamed in the EZSDK build system. After trying, it will give an error which can be ignored. Now choose the following:
.uia.xml file: dm81xx_hdvpss.uia.xml .rta.xml file: dm81xx_hdvpss.rta.xml Clock Freq : 250 <for DM816x>, 200 <for DM814x>
Press OK.
(click on the picture to enlarge)
- After the UIA Configuration, the window looks like:
(click on the picture to enlarge)
- You can now save the UIA config file into location of your choice. For subsequent System Analyzer sessions, users can import the UIA Configuration from this saved config file
This concludes setting up a System Analyzer session.
Running a System Analyzer Session[edit]
This section lists the steps to run a System Analyzer session in CCS.
- In the CCS Session, go to Tools->System Analyzer->Live.
(click on the picture to enlarge)
- A dialog box will popup "Live Parameters". In the field Instrumentation (UIA) Config, choose the UIA config file you created before.
- Ensure that the IP address in the field "IP Address" matches the IP address of the target board you are using.
- Select which analysis features to run
- Users may optionally set a duration for which to collect data for by selecting the "Collect data for" option and setting an appropriate time. Or, users may collect data until manually paused by selecting the "Until data transfer is manually paused" option
- Users can also specify a file to save data to using the "Save data to file also" option. This allows users to open the data later for analysis using Tools->System Analyzer->Open Binary File and picking the saved file
(click on the picture to enlarge)
- Ensure that you can ping the board from your host.
- Start the A8 application application (capture_encode). And then press the Run button in the Live parameters dialog box. This order of execution is important. You should now see CCS fetching logs from the target.
- Once the log fetch is complete, you can see the CPU load, execution graphs by going to Tools->System Analyzer->System Analyzer Live Session->CPU Load/Task Load/Execution Graph/etc. This will be explained in the subsequent section.
Analyzing and Interpreting data using System Analyzer[edit]
There are various Analysis Features in System Analyzer. A few of them are shown below.
Note! that the example shown below for each of the analysis features is for the Graphical View. These Analysis Features also support tabular representation of the using the Summary or Detail view. Please refer the System Analyzer User Guide for more details.
- CPU Load: This shows the CPU Load as % load plotted against time. A curve showing the variation in CPU Load for the configured End Points (Media Controllers - VIDEO and VPSS) can be seen as shown below. This shows the VIDEO CPU load as 18% and the VPSS CPU load as 34%.
(click on the picture to enlarge)
- Task Load: This shows the Task Load of various thread as % load plotted against time. A curve showing the variation in Task Load for the various threads running on the selected Media Controllers (in this example, VIDEO) - can be seen as shown below. The thread names can also be seen in this plot.
(click on the picture to enlarge)
- Execution Graph: This shows the execution sequence of the various tasks running on the Media Controllers - VIDEO and VPSS. The task names can also be seen in this plot.
(click on the picture to enlarge)
Note! Users are recommended to go through the System Analyzer User Guide to know more about the analysis features, its usage and representation. Chapter 4 of http://processors.wiki.ti.com/images/b/b5/MCSA_User_Guide.pdf titled - Using System Analyzer in Code Composer Studio contains information on this.
Note! Users having access to firmware source code, may add more instrumentation to the code using UIA. Users are recommended to go through the System Analyzer User Guide to know more about the usage of UIA macros and functions to enhance instrumentation in the code and also know about how to view this on the host using System Analyzer. Chapter 5 of http://processors.wiki.ti.com/images/b/b5/MCSA_User_Guide.pdf titled - UIA Configuration and Coding on the Target contains information on this.
Setting up & Running System Analyzer Session for DSP[edit]
The DSP firmware built in EZSDK does not have the necessary changes to integrate UIA and use System Analyzer in the same way as mentioned above for the VIDEO and VPSS Media Controller.
This section documents the changes needed to integrate UIA and use System Analyzer with DSP. This is to enable users to add this support for the available version of EZSDK.
In the file /examples/ti/omx/demos/dm81xx/DspAppMain.cfg, add the following at the end and recompile DSP firmware:
/* ====================================================== */ /* ================ Logger configuration ================ */ /* ====================================================== */ var Defaults = xdc.useModule('xdc.runtime.Defaults'); var Diags = xdc.useModule('xdc.runtime.Diags'); var Main = xdc.useModule('xdc.runtime.Main'); var Load = xdc.useModule('ti.sysbios.utils.Load'); Load.hwiEnabled = false; Load.swiEnabled = false; /* * Create a static task for M3 UIA configuration */ var taskParams = new Task.Params(); taskParams.instance.name = "uiaServerTask"; task_params.stackSize = 0x6000; Task.create('&uiaServerTask', taskParams); /* * Create a LoggerSM instance and use it for all logging. Make sure it is at the same section for all cores (DSP, Video, VPSS) and not put anything else in "LOGGER_SM". All cores will share this same memory. All cores must have numCores and sharedMemorySize be the same value. */ var LoggerSM = xdc.useModule('ti.uia.runtime.LoggerSM'); LoggerSM.partitionId = 0; LoggerSM.bufSection = ".loggerSM"; LoggerSM.sharedMemorySize = 0x00100000; LoggerSM.numPartitions = 3; LoggerSM.decode = true; LoggerSM.overwrite = false; var statusLogger = LoggerSM.create(); /* * Make sure the section is in LOGGERSM (defined in * ti\omx\build\MemSegmentDefinition.xs). Also make sure it is a NOLOAD * section. This avoids wiping out another cores logger memory when more * than one cores is loaded. */ Program.sectMap[".loggerSM"] = new Program.SectionSpec(); Program.sectMap[".loggerSM"].loadSegment = "LOGGER_SM"; Program.sectMap[".loggerSM"].type = "NOLOAD"; /* * Plug the LoggerSM logger into LoggerCircBuf. All STATUS events * and logs from Main will go to the LoggerSM instance */ LoggerCircBuf = xdc.useModule('ti.uia.runtime.LoggerCircBuf'); LoggerCircBuf.statusLogger = statusLogger; LoggerCircBuf.filterByLevel = true; LoggerCircBuf.moduleToRouteToStatusLogger = "xdc.runtime.Main"; /* * Use LoggingSetup which uses UploadMode_JTAGSTOPMODE as the * default. Increase the Log sizes. * * Configuration done by the application is still honored (e.g. setting * up the common$.diags mask). * * Please refer to the ti.uia.sysbios.LoggingSetup module for more * details and configuration options. */ var LoggingSetup = xdc.useModule('ti.uia.sysbios.LoggingSetup'); LoggingSetup.loadLoggerSize = 1024*10; LoggingSetup.mainLoggerSize = 1024*1024; LoggingSetup.sysbiosLoggerSize = 32768*10; /* Use the a transport to move the records to MCSA */ LoggingSetup.eventUploadMode = LoggingSetup.UploadMode_NONJTAGTRANSPORT; /* ================ UIA configuration ================ */ /* * The default is to have a single core. This example is a multi-core * example. So UIA must be told to act accordingly. */ var ServiceMgr = xdc.useModule('ti.uia.runtime.ServiceMgr'); ServiceMgr.topology = ServiceMgr.Topology_MULTICORE; ServiceMgr.transportType = ServiceMgr.TransportType_NULL; /* The HOST is the master UIA processors */ ServiceMgr.masterProcId = 3; /* The application is using the UIA benchmark events. */ var UIABenchmark = xdc.useModule('ti.uia.events.UIABenchmark'); var UIAStatistic = xdc.useModule('ti.uia.events.UIAStatistic'); /* * Turn on ANALYSIS for benchmark events and others for Log_print used in app */ /* RUNTIME_ON Diags masks */ Main.common$.diags_USER1 = Diags.RUNTIME_ON; /* RUNTIME_OFF Diags masks */ Main.common$.diags_ANALYSIS = Diags.RUNTIME_ON; Main.common$.diags_ENTRY = Diags.RUNTIME_OFF; Main.common$.diags_EXIT = Diags.RUNTIME_OFF; Main.common$.diags_USER2 = Diags.RUNTIME_OFF; Main.common$.diags_USER3 = Diags.RUNTIME_OFF; Main.common$.diags_USER4 = Diags.RUNTIME_OFF; Main.common$.diags_USER5 = Diags.RUNTIME_OFF; Main.common$.diags_USER6 = Diags.RUNTIME_OFF; Main.common$.diags_USER7 = Diags.RUNTIME_OFF; Main.common$.diags_INFO = Diags.RUNTIME_OFF; Main.common$.diags_USER8 = Diags.RUNTIME_OFF; /* Turning Semaphore logging off */ Semaphore.common$.diags_USER1 = Diags.RUNTIME_OFF; Semaphore.common$.diags_USER2 = Diags.RUNTIME_OFF;
The steps to set up and run a System Analyzer session for DSP are similar to VIDEO and VPSS Media Controllers as mentioned above.
Note!'Main.common$.diags_ANALYSIS' is set to Diags.RUNTIME_ON. In order to disable logging for performance analysis by System Analyzer, users may set this to Diags.RUNTIME_OFF and recompile DSP firmware.
Note! A future version of EZSDK will have this integrated for DSP in the same way as done for VIDEO and VPSS Media Controllers
Download the Latest EZSDK[edit]
The latest EZSDK is available for download from http://software-dl.ti.com/dsps/dsps_public_sw/ezsdk/latest/index_FDS.html.
The current version is 5.05.02.00. The supported platforms are DM816x and DM814x.
EZSDK Support | ||||||||
|