Forum Discussion
Altera_Forum
Honored Contributor
14 years agoThrowing time snapshots around a single instruction isn't going to yield any answer besides 0. The timer resolution isn't fine grain enough to count clock cycles. Typically you measure the time for a criticial section of code and if that's too short you throw it into a loop to measure an average time per loop iteration.
You could create a timer core with a resolution of a clock cycle to measure something like k=1; but to be honest it doesn't seem like something worth doing..... if you want to debug your measuring technique why not just put a usleep() call in there for a significant amount of time and see if the measured value is in the same ballpark as the sleep time you passed into usleep()?