Count clock cycles of a particular algorithm

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

Count clock cycles of a particular algorithm

跳至解决方案
1,107 次查看
carlostadeoorte
Contributor III

Hello,

 

I would like to know if any of you know how to count the cycles (or instruction count) executed between 2 breakpoints on KDS?.  Alternatively do any of you know if there is a way to know the timestamp between two breakpoints.

 

Thank you!

 

-Carlos

标签 (1)
1 解答
675 次查看
DavidS
NXP Employee
NXP Employee

Hi Carlos,

Which Kinetis device are you using?

Are you using RTOS?  If yes which?

If MQX please review this previous Community Post:

Re: elapsed time in nanoseconds

If baremetal then you could use a PIT timer to is derived from the Peripheral Bus Clock (1/2 the core clock) and start the timer are one breakpoint and stop it at the second breakpoint.  Be careful the PIT has not overflown.

Regards,

David

在原帖中查看解决方案

0 项奖励
回复
2 回复数
676 次查看
DavidS
NXP Employee
NXP Employee

Hi Carlos,

Which Kinetis device are you using?

Are you using RTOS?  If yes which?

If MQX please review this previous Community Post:

Re: elapsed time in nanoseconds

If baremetal then you could use a PIT timer to is derived from the Peripheral Bus Clock (1/2 the core clock) and start the timer are one breakpoint and stop it at the second breakpoint.  Be careful the PIT has not overflown.

Regards,

David

0 项奖励
回复
675 次查看
carlostadeoorte
Contributor III

Thank you, I am using the KL03 baremetal. Using the timers make sense. I was hoping for cycle count, but the timer approach will work as well I guess, I am thinking on counting a few microseconds with a core clock on the 1/2 MHz range, so I think it should not overflow.

Thank you!

-Carlos

0 项奖励
回复