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.

CPULoad ,ThreadLoad cannot be shown in RTA

Other Parts Discussed in Thread: SYSBIOS

HI,I reconfig taskexamples project from TI explore and add load analysis module, and run, debug by XDS100V2, it can only show Printf logs infor, CPU load,Thread Load can not be shown while task stop.

How I config the project and show CPU Load? XDS100V2 cannot support this feature?

  • CCS5.3 , SYS BIOS 6.34.2.18,F28335 device

  • In the task example for F28335, the Agent module (which enables RTA support) is not enabled. In order to get CPU Load/Thread load, this module should be enabled and configured. You may want to take a look at the Stairstep example which has the Agent module enabled and should let you see the CPU Load, Execution graph etc.

    Please note that in the future the Agent module will not be supported any more. Users are encouraged to move to System Analyzer/UIA for equivalent functionality. For more information on how to configure and use UIA, and how to port your existing SYS/BIOS application to use UIA, please refer to the System Analyzer Users Guide. To get familiar with System Analyzer, you could also take a look at the examples under "System Analyzer (UIA Target)" in the TI Resource Explorer.

  • In fact, both of Agent and CPU_load are enable. I think XDS100V2 cannot support CPU_load and Task Load feature, I think the .cfg is no error.

  • I don't think its a limitation on the xds100v2 emulator as the SYS/BIOS Stairstep example I believe works with that emulator. Have you given that a try?  

  • Hi,Sir!

    I run stairstepexamples. It can show CPU_load and Task Load, I also see .cfg and confirm RTA is enable. I have some confuses:

    1:  some documents about SYS BIOS says:CPU_load and Task Load is accumulated in IDLE task, but I see IDLE module is not configured into sys bios in .cfg, but when I stop the project, it halts in idle.c 

    So , I want to know IDLE task is necessary for calculating CPU_load adn Task Load? can you give some explanation why?

    2: It seem that you have to add user code to calculate HWI ,task or SWI load? I am very confused! does these Load statics calculated by SYS BIOS tools or not? 

  • Sorry for the delayed reply! I would recommend moving to System Analyzer for real-time analysis of SYS/BIOS applications. The older method of using the Agent module and underlying RTDX as the transport is now deprecated in newer releases of CCS.

    To help get started with System Analyzer you can take a look at the example templates we have included with CCS. There are UIA templates that use the "Stairstep" example which demonstrate the use of CPU Load and Execution graph.

  • Hi,Sir!

    I said I had run stairstep examples, I am sorry I don't understand it at all. I want to know it is my user code to do  CPU load or task load accumulating or SYS BIOS kernal?

    /*
    * ======== stairstep.c ========
    *
    * This example illustrates how the SYS/BIOS CPU Load and
    * Execution Graph tools are used to visualize the real-time
    * operation of an application.
    *
    * cpuLoadInit() gets the CPU frequency using an API and
    * fills the loadValue arrays with load values corresponding to
    * 0, 25, 50, 75 and 95 percent cpuload.
    *
    * timerFunc() (a Hwi thread) runs every 100ms and launches
    * 3 types of threads (Hwi, Swi, and Task).
    * Each respective thread then performs a corresponding load
    * function before relinquishing the CPU.
    *
    * After dwelling for 5 seconds at each load setting, timerFunc()
    * calls step() which advances to the next set of Hwi, Swi, and
    * Task load values. The cycle repeats forever.
    *
    * The loads of the 3 thread types can be seen separately using
    * CCS's Task Load view, and cumulatively with the CPU Load view.
    *
    * The BIOS Execution GUI depicts all the threads and transition
    * events.
    */

    #include <xdc/std.h>

    #include <xdc/runtime/Log.h>
    #include <xdc/runtime/Timestamp.h>
    #include <xdc/runtime/Types.h>
    #include <xdc/runtime/Diags.h>

    #include <ti/sysbios/BIOS.h>

    #include <ti/sysbios/knl/Semaphore.h>

    #include <ti/sysbios/knl/Swi.h>

    #include <xdc/cfg/global.h>

    #define LOAD_STEPS 20
    #define PERIOD 100 /* 100 ms (0.1 seconds) */

    #define NUMPERSEC (1000 / PERIOD)

    /*
    * Thread Load Tables
    */

    UInt hwiLoadPercent[LOAD_STEPS] = {0, 25, 50, 75, 95,
    0, 0, 0, 0, 0,
    0, 0, 0, 0, 0,
    0, 5, 10, 15, 20};

    UInt swiLoadPercent[LOAD_STEPS] = {0, 0, 0, 0, 0,
    0, 25, 50, 75, 95,
    0, 0, 0, 0, 0,
    0, 10, 15, 20, 25};

    UInt taskLoadPercent[LOAD_STEPS] = {0, 0, 0, 0, 0,
    0, 0, 0, 0, 0,
    0, 25, 50, 75, 95,
    0, 15, 20, 25, 30};

    ULong hwiLoadValue[LOAD_STEPS];
    ULong swiLoadValue[LOAD_STEPS];
    ULong taskLoadValue[LOAD_STEPS];

    ULong hwiLoadVal = 0;
    ULong swiLoadVal = 0;
    ULong taskLoadVal = 0;

    Int loadIndex = 0;

    Void cpuLoadInit(Void);
    Void doLoad(ULong count);
    Void hwiLoad(Void);
    Void step(Void);
    Void swiLoad(UArg arg1, UArg arg2);
    Void taskLoad(UArg arg1, UArg arg2);
    Void timerFunc(UArg arg);

    /*
    * ======== main ========
    */
    Void main()
    {
    Log_print0(Diags_USER1, "stairstep example started.");

    /* Set up the Hwi, Swi, and Task thread load tables */
    cpuLoadInit();

    BIOS_start();

    /* Fall into BIOS idle loop */
    return;
    }

    /*
    * ======== cpuloadInit ========
    */
    Void cpuLoadInit(Void)
    {
    Types_FreqHz freq;
    ULong maxLoad;
    Int i;

    /* freq is maximum timestamp counts per second (100% cpuload) */
    Timestamp_getFreq(&freq);
    maxLoad = freq.lo / NUMPERSEC; /* since we run load NUMPERSEC times */

    /*
    * calculate loadValues for each thread type for
    * each load interval (5 seconds)
    */
    for (i = 0; i < LOAD_STEPS; i++) {
    hwiLoadValue[i] = hwiLoadPercent[i] * maxLoad / 100;
    swiLoadValue[i] = swiLoadPercent[i] * maxLoad / 100;
    taskLoadValue[i] = taskLoadPercent[i] * maxLoad / 100;
    }
    }

    /*
    * ======== doLoad ========
    * stall in a loop until timestamp equals initial
    * value plus count.
    */
    Void doLoad(ULong count)
    {
    ULong now, end;

    /* compute load loop endpoint */
    end = Timestamp_get32() + count;

    /* loop until we reach termination timestamp */
    do {
    now = Timestamp_get32();
    } while ((end - now) < count);
    }

    /*
    * ======== hwiLoad ========
    */
    Void hwiLoad(Void)
    {
    static ULong oldLoad = ~0;

    /* display confirmation of load changes */
    if (oldLoad != hwiLoadVal) {
    oldLoad = hwiLoadVal;
    Log_print1(Diags_USER1, "Hwi load: new load = %d%%",
    hwiLoadPercent[loadIndex]);
    }

    if (hwiLoadVal) {
    doLoad(hwiLoadVal);
    }
    }

    /*
    * ======== step ========
    * Update the load values for all thread types
    */
    Void step(Void)
    {
    loadIndex++;

    if (loadIndex == LOAD_STEPS) {
    loadIndex = 0;
    }

    hwiLoadVal = hwiLoadValue[loadIndex];
    swiLoadVal = swiLoadValue[loadIndex];
    taskLoadVal = taskLoadValue[loadIndex];
    }

    /*
    * ======== swiLoad ========
    */
    Void swiLoad(UArg arg1, UArg arg2)
    {
    static ULong oldLoad = ~0;

    /* display confirmation of load changes */
    if (oldLoad != swiLoadVal) {
    oldLoad = swiLoadVal;
    Log_print1(Diags_USER1, "Swi load: new load = %d%%",
    swiLoadPercent[loadIndex]);
    }

    if (swiLoadVal) {
    doLoad(swiLoadVal);
    }
    }

    /*
    * ======== taskLoad ========
    */
    Void taskLoad(UArg arg1, UArg arg2)
    {
    static ULong oldLoad = ~0;

    while (TRUE) {
    Semaphore_pend(sem, BIOS_WAIT_FOREVER);

    /* display confirmation of load changes */
    if (oldLoad != taskLoadVal) {
    oldLoad = taskLoadVal;
    Log_print1(Diags_USER1, "Task load: new load = %d%%",
    taskLoadPercent[loadIndex]);
    }

    if (taskLoadVal) {
    doLoad(taskLoadVal);
    }
    }
    }

    /*
    * ======== timerFunc ========
    * This function runs every PERIOD ms in the context of a Hwi thread.
    */
    Void timerFunc(UArg arg)
    {
    static UInt tickCount = 0;

    /* change load values every 5 seconds */
    if (++tickCount >= (5 * NUMPERSEC)) {
    tickCount = 0;
    step();
    }

    /* Make Swi load thread ready to run */
    Swi_post(swi);

    /* Make Task load thread ready to run */
    Semaphore_post(sem);

    /* Do Hwi thread load now */
    hwiLoad();
    }