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.

Compiler/PROCESSOR-SDK-DRA7X: Processors forum

Part Number: PROCESSOR-SDK-DRA7X

Tool/software: TI C/C++ Compiler

Hello TI Team,

Multiple Thread are being created. we want to understand why so many threads with high priority  is being created. If they are not  required we would like to strip down certain threads.

Please find attached image. 

Additional Info :

M4 is loaded from IPL and usecase is from rtos (vision_sdk/apps/src/rtos/usecases/early_capture_lateweston_2s_2c_dsswb)

usecase:

eCase: early_capture_lateweston_2s_2c_dsswb

Capture -> Display_Video
DispDistSrc_weston -> Display_m4
DispDistSrc_vid3 -> Display_vid3
Capture_dsswb -> Alg_SwCrc


Regards,

Raghu

  • Hi Raghu,

    Some threads might be removed.

    Every Link in Link framework is running in a thread.

    When the Vision SDK Link framework is initialized, each registered Link by default will create a thread.

    Those Links will be created and stay in idle even if your use case is not using those links.

    If you have only one specific use case to run in your system, you can remove the unused Links so they won't be created.

    Please refer to System_initLinks() in ~/vision_sdk/links_fw/src/hlos/system/system_common.c.

    You can comment out the calling of init function for the unused Links.

    Regards,
    Stanley

  • Hi ,

    After removing some of them still we are seeing too many thread. We would like to further reduce. 

    Basically we are running usecase from RTOS. So we dont want any thread running on HLOS unnecessarily 

    Void System_initLinks(void)
    {
    Vps_printf(" SYSTEM: Initializing A15 Links !!! \r\n");

    IpcOutLink_init();
    IpcInLink_init();
    // NullLink_init();
    // NullSrcLink_init();
    DispDistSrcLink_init();
    #ifdef ALG_surroundview
    //Sgx3DsrvLink_init();
    #endif
    #ifdef BUILD_INFOADAS
    EpLink_init();
    #else
    //AlgorithmLink_init();
    //DupLink_init();
    //SyncLink_init();
    //MergeLink_init();
    //SelectLink_init();
    //GateLink_init();
    //SgxFrmcpyLink_init();
    #ifdef ALG_structurefrommotion
    //Sgx3DsfmLink_init();
    #endif
    #endif
    Vps_printf(" SYSTEM: Initializing A15 Links ... DONE !!! \r\n");
    }

    Question: Is there way we can name this thread in the code? 

    Threads:

    root@mmt2020-a880:~# cputop -l4 now | grep -i "vsdkapps"
    1 vsdkapps 1052 vsdkapps 1052 cfs 0 0.00 n/a n/a
    1 vsdkapps 1054 vsdkapps 1052 rr 50 0.10 n/a n/a
    1 vsdkapps 1056 vsdkapps 1052 rr 99 0.00 n/a n/a
    1 vsdkapps 1057 vsdkapps 1052 rr 50 0.00 n/a n/a
    1 vsdkapps 1058 vsdkapps 1052 rr 50 0.00 n/a n/a
    1 vsdkapps 1059 vsdkapps 1052 rr 50 0.00 n/a n/a
    1 vsdkapps 1060 vsdkapps 1052 rr 50 0.00 n/a n/a
    1 vsdkapps 1061 vsdkapps 1052 rr 50 0.00 n/a n/a
    1 vsdkapps 1062 vsdkapps 1052 rr 50 0.00 n/a n/a
    1 vsdkapps 1063 vsdkapps 1052 rr 50 0.00 n/a n/a
    1 vsdkapps 1064 vsdkapps 1052 rr 50 0.00 n/a n/a
    1 vsdkapps 1065 vsdkapps 1052 rr 50 0.00 n/a n/a
    1 vsdkapps 1066 vsdkapps 1052 rr 50 0.00 n/a n/a
    1 vsdkapps 1067 vsdkapps 1052 rr 50 0.00 n/a n/a
    1 vsdkapps 1068 vsdkapps 1052 rr 50 0.00 n/a n/a
    1 vsdkapps 1069 vsdkapps 1052 rr 50 0.00 n/a n/a
    1 vsdkapps 1070 vsdkapps 1052 rr 50 0.00 n/a n/a
    1 vsdkapps 1071 vsdkapps 1052 rr 50 0.00 n/a n/a
    1 vsdkapps 1072 vsdkapps 1052 rr 50 0.00 n/a n/a
    1 vsdkapps 1073 vsdkapps 1052 rr 50 0.00 n/a n/a
    1 vsdkapps 1074 vsdkapps 1052 rr 50 0.00 n/a n/a
    1 vsdkapps 1075 vsdkapps 1052 rr 50 0.00 n/a n/a
    1 vsdkapps 1076 vsdkapps 1052 rr 50 0.00 n/a n/a
    1 vsdkapps 1077 vsdkapps 1052 rr 50 0.00 n/a n/a
    1 vsdkapps 1078 vsdkapps 1052 rr 50 0.00 n/a n/a
    1 vsdkapps 1079 vsdkapps 1052 rr 50 0.00 n/a n/a
    1 vsdkapps 1080 vsdkapps 1052 rr 50 0.00 n/a n/a

    Note: After making this change 32 threads where reduced. But we need to still reduce

    Regards,

    Raghu

  • Could you put a "printf" in OSA_thrCreate() under ~/vision_sdk/links_fw/src/hlos/osa/src/osa_thr.c?

    We can see if the thread is created by the Link framework or not? Link framework will create thread via calling this API.

    Regards,
    Stanley

  • Hi Stanley, 

    We would like to name this threads, currently all are named as "VSDKAPPS" we can't identify which thread is being created. 

    Regards,

    Raghu

  • Hi Raghu,

    pthread has API to add name to a thread. It is documented in Linux API. You can look it up. However, I was not able to find where those threads are created so I am not sure where you can add the call to do this.

    If you can connect GDB debugger, you can trace the apps.out to find where the threads are created.

    Can you do that?

    Regards,
    Stanley

  • Hi Raghu,

    Can you make this change and rebuild the firmwares and app and give a try?

    --- a/links_fw/src/rtos/utils_common/src/utils_tsk.c

    +++ b/links_fw/src/rtos/utils_common/src/utils_tsk.c

    @@ -232,6 +232,7 @@ Int32 Utils_tskCreate(Utils_TskHndl * pHndl,

                         pHndl,

                         pHndl->tskAffinity

                       );

    +    Vps_printf("Created task %s\n", tskName);

         UTILS_assert(pHndl->tsk != NULL);

    This would print the all the names of tasks created for each link enabled when apps.out is loaded.

    I searched whole visionSDK for the string vsdkapps but I didn't find this string.

    Thanks

    RamPrasad

  • Hi Ram,

    I can check this but, this will only print "VSDKAPPS" again and again, which will not lead to any conclusion. 

    Changing the names of the Threads at the creation would be helpful as mentioned earlier. 

    Regards,

    Raghu