Execution Measurement on MBDT KVx

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Execution Measurement on MBDT KVx

跳至解决方案
1,900 次查看
CauTran
Contributor I

Hi, 

I want to measure the execution time for my application based on MBDT KVx. 

How can I do this one? 

0 项奖励
回复
1 解答
1,880 次查看
nxa11767
NXP Employee
NXP Employee

Hi @CauTran ,

 

We currently don't have enabled for the toolbox the Code execution profiling support, but you can try to use the Timer blocks to measure the execution time of a subsystem.

You can configure for e.g the PIT timer from MCUX configuration Tool in free running mode (set the period to the max value)

nxa11767_5-1637841903292.png

 

In the model, place all your code in a subsystem for e.g; add the Start/Stop Timer block - one block that will start the timer and another to stop the timer and a register read block to read the CVAL0 value (if channel 0 enabled). Add priorities to the blocks and subsystems (right click on the block/subsystem and set Priority)- Start Timer higher priority ( 0 - is highest priority), then your subsystem that you want to measure, the Read Register block and last Stop Timer block. You need to read first the CVAL0 register and then stop the Timer, because the StopTimer call will reset the registers.

nxa11767_0-1637840664693.png

 

And to get number of ticks you just need to substract from max timer value the value of CVAL0 (PIT timer counts down - at start is equal with period set in configuration tool and goes down from there).

nxa11767_4-1637841749910.png

 

Hope this helps,

Alexandra

 

在原帖中查看解决方案

0 项奖励
回复
3 回复数
1,868 次查看
CauTran
Contributor I

Hi @nxa11767 , 

Can you give me this example for that topic? 

Thank you so much.

0 项奖励
回复
1,848 次查看
nxa11767
NXP Employee
NXP Employee

Hi @CauTran ,

See attached the example. It has also a freemaster block to see the counted ticks variable. 

 

BR,
Alexandra

0 项奖励
回复
1,881 次查看
nxa11767
NXP Employee
NXP Employee

Hi @CauTran ,

 

We currently don't have enabled for the toolbox the Code execution profiling support, but you can try to use the Timer blocks to measure the execution time of a subsystem.

You can configure for e.g the PIT timer from MCUX configuration Tool in free running mode (set the period to the max value)

nxa11767_5-1637841903292.png

 

In the model, place all your code in a subsystem for e.g; add the Start/Stop Timer block - one block that will start the timer and another to stop the timer and a register read block to read the CVAL0 value (if channel 0 enabled). Add priorities to the blocks and subsystems (right click on the block/subsystem and set Priority)- Start Timer higher priority ( 0 - is highest priority), then your subsystem that you want to measure, the Read Register block and last Stop Timer block. You need to read first the CVAL0 register and then stop the Timer, because the StopTimer call will reset the registers.

nxa11767_0-1637840664693.png

 

And to get number of ticks you just need to substract from max timer value the value of CVAL0 (PIT timer counts down - at start is equal with period set in configuration tool and goes down from there).

nxa11767_4-1637841749910.png

 

Hope this helps,

Alexandra

 

0 项奖励
回复