This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[FAQ] TDA4VM: How to do a run time logging of events in an OpenVX application using OpenVx Performance Analyzer?

Part Number: TDA4VM

I want to do some kind of even logging in my OpenVX application to look for possible bottlenecks in execution, is there a way I can do that? I'm using PSDKRA 7.0.

  • We have many HW accelerators and CPUs in the TDA4 SoC, due to this a lot of processing functions in an application can run in parallel and result in better performance due to pipelining.

    But sometimes due to some configuration problems or other issues, we don't get expected performance and that time we need to look at how things are running, in what sequence are they running and how fast are they running. With that information we can get an idea as to where the bottleneck is.

    The TIVX_LOG_RT tool helps us in visually inspecting the execution of different node on different CPUs / HW accelerators w.r.t. global timestamp.

    We can do a two level analysis as follows:

    1. Performance Statistics: The framework is collecting information as things are running and the in interactive mode (by pressing 'p' in the menu), we can print the snapshot of this information. The performance statistics snapshot has information on average time of execution for a node to process 1 frame and also what time the overall application took to process one frame (let's call this T which determines the FPS).
      1. A well pipelined application will have T just slightly above the max of the individual processing nodes.
      2. If T >> max of the individual processing nodes, then we can go to the next level of analysis using the TIVX_LOG_RT tool.
    2. TIVX_LOG_RT: See below

    TIVX_LOG_RT

    This tool enables run-time node start/stop event logging.

    Tool outputs a .bin file on the target (EVM) and this can be post processed using offline tools to give .vcd and .html files.

    How to enable RT logging in an application

    To enable run-time event logging in your program do below,

    1. After graph verify but before graph execution, call tivxLogRtTraceEnable(graph) to enable event logging for that graph.
    2. Execute the graph as usual.
    3. After graph executions have stopped, or periodically, call tivxLogRtTraceExportToFile(filename) to save event data to a file.
    4. After graph executions have stopped and before vxReleaseGraph, call tivxLogRtTraceDisable(graph) to disable run-time logging for that graph.

    How to visualize the graph data

    Install and build gtkwave: [ONE TIME ONLY]

    sudo apt-get install gtkwave
    cd <PSDKRA_INSTALL_DIR>/tiovx/tools/tivx_log_rt
    make

    To visualize the graph data do below:

    1. Copy the event log .bin file, saved on EVM via tivxLogRtTraceExportToFile(filename), to a folder in your Linux PC.
    2. Generate .vcd file (Value Change Dump) file to visualize the events in gtkwaveas below
      tiovx/tools/tivx_log_rt/tivx_log_rt_2_vcd.out -i event_log.bin -o event_log.vcd
    3. Generate .html file to visualize per node frame level statistics as below
      tiovx/tools/tivx_log_rt/tivx_log_rt_2_html.out -i event_log.bin -o event_log.html
    4. Open the .vcd file in gtkwave
      gtkwave event_log.vcd
    5. In gtkwave, drag and drop the 'signals' of interest from bottom left frame to center frame and visualize the 'signals' in the right frame.
      1. Note that the 'signals' need to be dragged and dropped in sequence for easy interpretation of the application execution. The processing node that executes first should be place above.
      2. You can use the generated graph to get an idea on what order the nodes need to be placed.
    6. Open the .html file in web browser to visualize per node frame level statistics.
      1. Note that the html files uses dygraphs.js from http://dygraphs.com/ so make sure your internet connectivity works fine.

    Patches for the TIVX_LOG_RT & other offline tools on PSDKRA 7.0

    The tool was added after the PSDKRA 7.0 release and will be supported as a part of the SDK coming forward. The patches attached are to enable customers on PSDKRA 7.0 ahead of the next release.

    Patches are on top of tiovx and vision_apps and baseline is PSDKRA 7.0

    /cfs-file/__key/communityserver-discussions-components-files/791/tivx_5F00_log_5F00_rt.zip

    Steps to apply the patches are mentioned in the README in the above package.

    Sample outputs from app_tidl_avp2 demo

    /cfs-file/__key/communityserver-discussions-components-files/791/app_5F00_tidl_5F00_avp2_5F00_output.zip

    .vcd view

    1. There are two types of 'signals' in this view, openVX nodes and CPUs / HW accelerators. The nodes are typically represented as bus [3:0], appended by *Node and the CPU / HW accelerators are represented as single bit values (either HIGH or LOW).
    2. Nodes are ScalarNode[3:0], ODPreProcNode[3:0], ODTODLNode[3:0] etc. and CPU / HW accelerators are DISPLAY1, DSP-1, DSP-2, DSP_C7-1 etc.
    3. The value of the node 0, 1, 2, 3 .. depicts which frame is bring processed. This is a relative number just to get a better understanding that when a particular node is processing frame 3, which frame number is being processed by the other nodes.

    .html view

    1. The HTML view gives more of a statistical data.