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.

about APIs to find time spent in idle tasks - C66x

Other Parts Discussed in Thread: SYSBIOS

I want to find out the time spent in an idle task without using RTA tools. Can anyone suggest some API or some suitable method to do the same?

  • Nikhil,

    take a look at the Load module. It has some APIs to let you see your current CPU load.

  • hi TOM,

    I could see some APIs Load_getCPULOAD() , Load_getTaskLoad() etc.  but they are returning zero CPU n task loads in my small test program. Here is the code snippet:

    #include <stdio.h>
    #include <xdc/std.h>

    #include <xdc/runtime/System.h>
    #include <ti/sysbios/knl/Semaphore.h>
    #include <ti/sysbios/knl/Task.h>
    #include <ti/sysbios/utils/Load.h>
    #include <ti/sysbios/BIOS.h>

    #include <xdc/cfg/global.h>
    int k=0, l=0;

    void main(void) {
    printf("Hello World!\n");

    BIOS_start();
    }

    void task0_func(void) {
    Uint32 i, cpuload;

    long int k;

    stat1.threadTime = 5;
    stat1.totalTime = 5;
    while (1){
    for (i=0; i<50000 ; i++) {
    printf("CPU Load = %d \n",cpuload);
    k=k+1;
    }

    Task_sleep(1);
    Semaphore_post(semTap);
    Semaphore_pend(semTapp, BIOS_WAIT_FOREVER);
    }
    }

    void task1_func(void) {
    int i;
    while (1){
    for (i=0; i<50000 ; i++) {
    l = l+1;
    printf("Task1!\n");
    // Task_sleep(10);
    }
    Semaphore_post(semTapp);
    Semaphore_pend (semTap, BIOS_WAIT_FOREVER);

    }
    }

    how could i schedule my tasks(and what can I make them do) to make this API return some non zero load value?

  • hi,

    I am able to use the APIs successfully now and monitor the CPU load fairly accurately. cheers!!