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.

AM263P4-Q1: TaskP_loadGet() Higher priority task

Part Number: AM263P4-Q1

Tool/software:

Hi Team,

This question is a continuation from the related thread.

My customer wants to know if they use TaskP_loadGet(), will the higher priority tasks also be computed in the CPU load?

Best regards,

Mari Tsunoda

  • Hi Mari,

    Thank you for your patience while we assigned the correct owner here. Please allow some time for them to review and provide feedback.

    Best Regards,

    Zackary Fleenor

  • Hi,

    If you want to compute the load for a specific task, you can use: TaskP_loadGet(). If you want to compute the total CPU Load, use: TaskP_loadGetTotalCpuLoad().

    TaskP_loadGet() only calculates the CPU load for a specific task passed to it via the TaskP_Object *obj. It does not account for other tasks (higher or lower priority).

    So if a higher-priority task is running frequently, it will:
    - Preempt the current task, reducing its accumulated runtime (accRunTime)
    - But that higher-priority task’s load won’t be included in the TaskP_loadGet() result unless that specific task’s handle is passed in.
    - Returns the individual task's runtime as a percentage of the total system runtime
    - The calculation is: taskLoad->cpuLoad = TaskP_calcCpuLoad(taskObj->accRunTime, gTaskP_ctrl.accTotalTime)

    Instead you can use TaskP_loadGetTotalCpuLoad(), to check overall CPU utilization which includes all the higher priority tasks as well.

    Returns the percentage of CPU time spent on all tasks except the idle task(s)
    - The calculation is: cpuLoad = TaskP_LOAD_CPU_LOAD_SCALE - TaskP_calcCpuLoad(idleTaskTime, gTaskP_ctrl.accTotalTime)
    - This function subtracts the idle task's CPU usage from 100% to get the total CPU load

    Regards,
    Shaunak