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.

When does DSP measure the CPU load ?

Other Parts Discussed in Thread: SYSBIOS

Hi,everyone!

I'm wondering will the DSP tell the CPU load if I always have my different tasks running? As far as I know,only in idle loop can log data be transferred from DSP to CCS,then what if there is no idle loop in my program?Does this means CPU load graph always show nothing?But accdording the definition of CPU load,when I never spend time in the idle loop,CPU load should be 100%,it is a bit confusing to me.

My another question is about the log information used to draw Exec graph,it seems that the Exec graph has nothing to do with the idle loop,since it works well given the fact that I've got no idle loop in my program.

When I search the Raw logs for some reason,I can't find Load in it,what I can find is about hwi,task&semaphore(provided by RTASystemLog),but in the "stairstep.c" I can find RTALoadLog &Main Logger ,so it seems my load module fails to work.Is there anything else such as the logger should be configured before the LOAD works?

I know it is a boring question because if I've got no idel loop in my program,the CPU load is 100%,but I just want to know more about the details on measure of CPU load.

Could anybody help me?Thank you very much.

Zhao

 


  • Here is the Exec graph of my program

  • Hi Zhao,

    which version of BIOS are you using?

    Zhao Shui said:
    I'm wondering will the DSP tell the CPU load if I always have my different tasks running? As far as I know,only in idle loop can log data be transferred from DSP to CCS,then what if there is no idle loop in my program?Does this means CPU load graph always show nothing?But accdording the definition of CPU load,when I never spend time in the idle loop,CPU load should be 100%,it is a bit confusing to me.

    The calculation to measure the CPU load is a percentage of how much CPU time was NOT spent in the idle loop vs. some other context (Task/ Swi/ Hwi). You will always have an idle loop in a RTOS. SYS/BIOS automatically creates a idle loop and if you want you can hook in your own idle functions as part of that loop. I understand it seems counter-intuitive, but If you don't spend any time in the idle loop you can't get a load calculation and therefor you will get a 0% load.

    global CPU load = 100 * (1 - (min. time for a trip around idle loop * # times in idle loop)/(benchmark time window))

    Also, the longer benchmark time window frames, the higher the accuracy you will be able to achieve to mathematics involved here. 

    Zhao Shui said:
    My another question is about the log information used to draw Exec graph,it seems that the Exec graph has nothing to do with the idle loop,since it works well given the fact that I've got no idle loop in my program.

    The exec is generated by examining the log statements for context switches.

    Zhao Shui said:
    When I search the Raw logs for some reason,I can't find Load in it,what I can find is about hwi,task&;semaphore(provided by RTASystemLog),but in the "stairstep.c" I can find RTALoadLog &Main Logger ,so it seems my load module fails to work.Is there anything else such as the logger should be configured before the LOAD works?

    Did you add the Load module to your .cfg file:

    var Agent = xdc.useModule('ti.sysbios.rta.Agent');

    var Load = xdc.useModule('ti.sysbios.utils.Load');

    If you also want to log the loads for Swis and Hwis you will need this:

    Load.hwiEnabled = true;

    Load.swiEnabled = true;

    BIOS.libType = BIOS.LibType_Custom;

    Zhao Shui said:
    I know it is a boring question because if I've got no idel loop in my program,the CPU load is 100%,but I just want to know more about the details on measure of CPU load.

    More details on this can be found in the ti/sysbios/utils/Load API documentation

  • Hi,Tom!

    Thank you for your advice.My BIOS version is 6.33 and I've already added the load module in my sysbios. 

    Now my problem is partly solved.Yesterday,when I use the EDMA to carry a larger block of data, my program enter the idle loop after the EDMA starts,so I think the reason why there is no idle loop in my program is:the data block is TOO SMALL.

    Since I perform the EDMA transfer in a task and set a semaphore to wait for completion,if the EDMA finish its job very quickly,the DSP will just go on with the task,as a result,the Exec Graph doesn't show the idle loop.If the data block is big enough,it will take some time for EDMA to finish its job and the CPU enters an idle loop when waiting.

    This is my opinion,Am I right?Or How can I transfer a small data block while the program still enter an idle loop?

    Thanks,

    Zhao

  • Hi Zhao,

    There is an idle loop in SYS/BIOS. It will not be able to execute if there is always a Task in the ready state.

    Zhao Shui said:
    Since I perform the EDMA transfer in a task and set a semaphore to wait for completion,if the EDMA finish its job very quickly,the DSP will just go on with the task,as a result,the Exec Graph doesn't show the idle loop.If the data block is big enough,it will take some time for EDMA to finish its job and the CPU enters an idle loop when waiting.

    The scenario that you just described entirely depends on your application on how it was coded. You should be able to examine the logs to see if your semaphore gets posted before your Task pends on it. If the data block is so small, you could be spending more CPU time to set up and starting the DMA than by just having the CPU transfer it explicitly.