Forum Discussion
Altera_Forum
Honored Contributor
15 years agoConfirmation about method of calulate execution time
Hi I try to check the execution time of my algorithme. I use the high res_timer. I find on the tutorial how can calculate it, at least with this instruction: time1= alt_timestamp(); K=1; ...
Altera_Forum
Honored Contributor
15 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()?