- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Solved! Go to Solution.
- Labels:
-
Aurix
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.