Count clock cycles of a particular algorithm

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Count clock cycles of a particular algorithm

Jump to solution
1,139 Views
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

Labels (1)
1 Solution
707 Views
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

View solution in original post

0 Kudos
Reply
2 Replies
708 Views
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 Kudos
Reply
707 Views
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 Kudos
Reply