2016-09-06 11:40 AM
There are examples counting clock pulses with the DWT_CYCCNT, but it will overflow in time.
Counting pulses is easy if there is no overflow, but with overflow I am sure there nice way of doing it. I could do something like this. if old value>new value Max count of DWT_CYCCNT-old value+ new value. But how to get the max in DWT_CYCCNT and what happens if the DWT_CYCCNT overflows twice or more.2016-09-06 12:09 PM
Ask yourself what it is you want to measure, over what time intervals.
If you want to benchmark things under 24 seconds (@180MHz) then such durations and timeouts do not have worry about wrapping.If you want some long time base, use a slower counter, or a SysTick based counter counting off milli-seconds and seconds, for years.2016-09-06 12:31 PM
never came up with the idea that i need to count cycles @ a 32bit controller. last time i debugged efficiency was on an 8bit.
for program flow 1ms timestamp is more than enough.2016-09-06 12:46 PM
> never came up with the idea that i need to count cycles @ a 32bit controller. last time i debugged efficiency was on an 8bit.
>
> for program flow 1ms timestamp is more than enough. I envy your easy job. Oh, wait, no, I love real challenges. JW2016-09-06 12:46 PM
> never came up with the idea that i need to count cycles @ a 32bit controller. last time i debugged efficiency was on an 8bit.
>
> for program flow 1ms timestamp is more than enough. I envy your easy job. Oh, wait, no, I love real challenges. JW2016-09-06 01:07 PM
A wonder, the forum did not crash.
I was planning to let counter to run continuously for some time and check the results via serial bus.