Vision Apps User Guide
Remote Core Heap Statistics

Introduction

This application queries remote services running on each of the remote RTOS cores and reports instantaneous memory utilization of the various memory regions for each remote core. This utility is helpful to see the remote core memory utilization required for running one or more applications on the HLOS.

It can also be used to quickly identify if running an application on the HLOS incurrs any memory leaks on a remote core. To do this, one simply needs run this utility before and after running an application, and then compare the printout between the two runs to see if memory utilization has changed.

Background

Upon booting of different remote cores, some of the local memory sections are initialized and allocated according to the compiled programs running on each core (regardless of what is running on the HLOS). This is why if you run this utility after the HLOS finishes booting before running any other program, there is some of the remote core local memory regions already reserved.

Likewise, when an OpenVX graph is created and "validated", some of the node which run on the remote cores may require to reserve some persistent or scratch memory. This is taken from the pool of remote local carveout. If this memory runs out, then the OpenVX vxVerifyGraph() function will fail, which should prompt the developer to carve out larger memory carveouts for that specific remote core and recompile so that the application can run with sufficient memory. Upon deleting the graph, any memory reserved by associated nodes shall be freed, thus returning the memory allocation state to what it was before running creating the graph and running the application.

Supported plaforms

Platform Linux x86_64 Linux+RTOS mode QNX+RTOS mode SoC
Support NO YES YES J721e

Steps to run the application on J721e EVM (Linux + RTOS mode)

  1. Build the application and related libraries as mentioned in Build Instructions for Linux+TI-RTOS mode
  2. Run the app as shown below
    cd /opt/vision_apps
    source ./vision_apps_init.sh
    ./vx_app_heap_stats.out
  3. Output will be sent to the terminal standard output.

Steps to run the application on J721e EVM (QNX + RTOS mode)

  1. Build the application and related libraries as mentioned in Build Instructions for QNX+TI-RTOS mode
  2. Run the app as shown below
    cd /ti_fs/vision_apps
    . ./vision_apps_init.sh
    ./vx_app_heap_stats.out
  3. Output will be sent to the terminal standard output.

Sample Output

Shown below is a example output from running this utility:

root@j7-evm:/opt/vision_apps# ./vx_app_heap_stats.out
APP: Init ... !!!
MEM: Init ... !!!
MEM: Initialized DMA HEAP (fd=4) !!!
MEM: Init ... Done !!!
IPC: Init ... !!!
IPC: Init ... Done !!!
REMOTE_SERVICE: Init ... !!!
REMOTE_SERVICE: Init ... Done !!!
APP: Init ... Done !!!
Detailed CPU memory statistics,
===============================
CPU: mcu2_0: HEAP: DDR_SHARED_MEM: size = 8388608 B, free = 8386304 B ( 99 % unused)
CPU: mcu2_0: HEAP: L3_MEM: size = 131072 B, free = 131072 B (100 % unused)
CPU: mcu2_0: HEAP: DDR_NON_CACHE_M: size = 65536 B, free = 65536 B (100 % unused)
CPU: mcu2_1: HEAP: DDR_SHARED_MEM: size = 16777216 B, free = 16774912 B ( 99 % unused)
CPU: mcu2_1: HEAP: L3_MEM: size = 131072 B, free = 131072 B (100 % unused)
CPU: mcu2_1: HEAP: DDR_NON_CACHE_M: size = 67043328 B, free = 47144960 B ( 6 % unused)
CPU: c6x_1: HEAP: DDR_SHARED_MEM: size = 16777216 B, free = 16774912 B ( 99 % unused)
CPU: c6x_1: HEAP: L2_MEM: size = 229376 B, free = 229376 B (100 % unused)
CPU: c6x_1: HEAP: DDR_SCRATCH_MEM: size = 50331648 B, free = 50331648 B ( 14 % unused)
CPU: c6x_2: HEAP: DDR_SHARED_MEM: size = 16777216 B, free = 16774912 B ( 99 % unused)
CPU: c6x_2: HEAP: L2_MEM: size = 229376 B, free = 229376 B (100 % unused)
CPU: c6x_2: HEAP: DDR_SCRATCH_MEM: size = 50331648 B, free = 50331648 B ( 14 % unused)
CPU: c7x_1: HEAP: DDR_SHARED_MEM: size = 268435456 B, free = 268435456 B ( 4 % unused)
CPU: c7x_1: HEAP: L3_MEM: size = 8159232 B, free = 8159232 B (100 % unused)
CPU: c7x_1: HEAP: L2_MEM: size = 491520 B, free = 491520 B (100 % unused)
CPU: c7x_1: HEAP: L1_MEM: size = 16384 B, free = 16384 B (100 % unused)
CPU: c7x_1: HEAP: DDR_SCRATCH_MEM: size = 234881024 B, free = 234881024 B ( 8 % unused)
APP: Deinit ... !!!
REMOTE_SERVICE: Deinit ... !!!
REMOTE_SERVICE: Deinit ... Done !!!
IPC: Deinit ... !!!
IPC: DeInit ... Done !!!
MEM: Deinit ... !!!
MEM: Alloc's: 0 alloc's of 0 bytes
MEM: Free's : 0 free's of 0 bytes
MEM: Open's : 0 allocs of 0 bytes
MEM: Deinit ... Done !!!
APP: Deinit ... Done !!!
APP HEAP STATS: Done !!!