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: How to calculate CPU load for tasks and interrupts

Part Number: AM263P4-Q1

Hi,

 

We are triggering an interrupt handler (RTI event) every 50 microseconds, and each execution takes 20 microseconds. 

Therefore, we estimate the CPU load to be 40%.

We measured the CPU load of each task using TaskP_loadGet() and the total CPU load of the core using TaskP_loadGetTotalCpuLoad(). 

After a 1-second measurement period, we called TaskP_loadResetAll(). The results are shown in the table below.

image.png

The discrepancy between Result A and Result B suggests that the interrupt processing is included in the task load measurement.  

However, the observed difference is approximately 11.9%, which is considerably lower than the initially estimated CPU load of 40%.

Interrupt image

image.png

 

Task execution image

image.png

 

The interrupts in the green section are included in the Core's CPU load, but aren't the interrupts in the blue section not included in the Core's CPU load?

Could you kindly explain how to obtain the CPU load for all active tasks and interrupts, as indicated by the red box in the diagram below?

image.png

  • Hi Imaoka-San,

    Allow me to check this and get back to you.

    Regards,

    Aswin

  • Hi Imaoka-San,

    Your understanding is correct. The metrics also re-instantiate it. The API would include the ISR time as well. So a method would be to calculate the ISR load and TASK + ISR load separately and then compute the TASK only load from the same. I can give a reference to this. 
    There is a project called interrupt profiling. This project is not present in AM263P but the source code is present. Please see the interrupt_profiling.c file in the SDK.

    There task computation is done by excluding the ISR timings. The file is present in this path : examples\kernel\freertos\interrupt_profiling\interrupt_profiling.c

    This project is present in AM263 SDK. I will share the project here for your convenience.

    interupt_profiling_am263.zip

    Regards,

    Aswin

  • Specifically, please see the computation part here