07-30-2010 09:22 AM
Hi,
Can anyone guide me that How to calculate the execution time of a Loop for one iteration?
Thanks and Regards,
Rashid
Solved! Go to Solution.
07-30-2010 09:36 AM
You can use a timer inside the loop like "tick count".
07-30-2010 09:45 AM
07-30-2010 09:51 AM
I hope I got your question! See attached screenshot
07-30-2010 09:51 AM
Thanks muks for your reply.
If I use one "tick count" outside the loop and second inside the loop, and then subtract their output through shift registers, Will this method be correct to calculate the execution time of the loop or there is some simple way to do this?
Kindly reply.
Regards,
Rashid
07-30-2010 10:08 AM
07-30-2010 10:10 AM
Thanks muks, smercurio_fc and FHM for your replies. My problem is solved.
Regards,
Rashid
07-30-2010 10:31 AM
> How to calculate the execution time of a Loop?
This is one of those things you cannot calculate from first principles. You need to actually measure it. 😄
07-30-2010 10:34 AM
Hi altenbach,
Kindly explain. I did not get you.
Thanks and Regards,
Rashid
07-30-2010 10:45 AM
The loop time can depend on may unknown and complicated factors (CPU speed and type, number of cores, OS, code inside the loop, parallel code outside the loop, any other program or service running on the computer, etc.etc.), so it cannot be calculated without running the program, even if all that information is known. There are too many unknown factors!
The only way to determine the loop rate is to run the loop and actually measure the tick count increment (Which of course also involves some calculations). I am sure that's what you meant. 😄