AURIX TC277 measure CPU performance

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
tw76th
Level 1
Level 1
5 replies posted 10 sign-ins First reply posted

Hello everyone. The simplified program structure is as follows:

void IsrTask_50ms()
{
...... //Real Job
}

int core0_main(void)
{
......
while(1); //Do nothing in th loop
}

When I want to use OCDS to measure how much CUP loading is used in IsrTask_50ms, a problem arises:
Obviously, the program in IsrTask_50ms is the real work, and while(1) in core0_main is actually meaningless.
However, the while instruction will also increase the ICNT. Then using "ICNT/CCNT" can't explain the CUP loading of IsrTask_50ms?


Can such a program display the loading of real job?

#include "IfxCpu.h"
IfxCpu_Perf FreeTime, WorkingTime;

void IsrTask_50ms()
{
FreeTime = IfxCpu_stopCounters();

IfxCpu_resetAndStartCounters();
...... //Real Job
WorkingTime = IfxCpu_stopCounters();

IfxCpu_resetAndStartCounters();
}

loading = WorkingTime.clock / (FreeTime.clock+WorkingTime.clock);

Additional questions:
Under what circumstances will ICNT/CCNT change significantly?
What is the effect of the value of M1CNT, M2CNT, M3CNT?


Thanks.

0 Likes
1 Solution
µC_Wrangler
Employee
Employee
50 solutions authored 100 sign-ins 25 likes received

Hi @tw76th .  You've got the right idea - start and stop the counters around where you need to measure performance.

However, the function IfxCpu_resetAndStartCounters clears the performance counters.  So, you might want to copy that function and make a new one that doesn't reset the counters (but still sets CE to enable them).

ICNT increments with every instruction, and CCNT increments on every clock cycle.

M1CNT/M2CNT/M3CNT can be configured by changing CCTRL to four different sets of values - see Table 5-17 MultiCount Configuration in the User Manual.

View solution in original post

1 Reply
µC_Wrangler
Employee
Employee
50 solutions authored 100 sign-ins 25 likes received

Hi @tw76th .  You've got the right idea - start and stop the counters around where you need to measure performance.

However, the function IfxCpu_resetAndStartCounters clears the performance counters.  So, you might want to copy that function and make a new one that doesn't reset the counters (but still sets CE to enable them).

ICNT increments with every instruction, and CCNT increments on every clock cycle.

M1CNT/M2CNT/M3CNT can be configured by changing CCTRL to four different sets of values - see Table 5-17 MultiCount Configuration in the User Manual.