Showing results for 
Search instead for 
Did you mean: 
Reply

How to calculate the execution time of a Loop?

Solved!
Go to Solution

How to calculate the execution time of a Loop?

Hi,

 

    Can anyone guide me that How to calculate the execution time of a Loop for one iteration?

 

Thanks and Regards,

 

Rashid

0 Kudos
Message 1 of 14 (16,838 Views)
Reply
0 Kudos

Re: How to calculate the execution time of a Loop?

You can use a timer inside the loop like "tick count".

Message 2 of 14 (16,828 Views)

Re: How to calculate the execution time of a Loop?

Message 3 of 14 (16,821 Views)
Solution
Accepted by topic author Rashid931
‎08-27-2015 06:09 PM

Re: How to calculate the execution time of a Loop?

I hope I got your question! See attached screenshot

Message 4 of 14 (16,815 Views)

Re: How to calculate the execution time of a Loop?

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

0 Kudos
Message 5 of 14 (16,813 Views)
Reply
0 Kudos

Re: How to calculate the execution time of a Loop?

Rashid,

 

Check this.

Message 6 of 14 (16,792 Views)

Re: How to calculate the execution time of a Loop?

Thanks muks, smercurio_fc and FHM for your replies. My problem is solved.

 

Regards,

 

Rashid

0 Kudos
Message 7 of 14 (16,791 Views)
Reply
0 Kudos

Re: How to calculate the execution time of a Loop?

> 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. Smiley Very Happy

Message 8 of 14 (16,772 Views)

Re: How to calculate the execution time of a Loop?

Hi altenbach,

 

                Kindly explain. I did not get you.

 

Thanks and Regards,

 

Rashid

0 Kudos
Message 9 of 14 (16,768 Views)
Reply
0 Kudos

Re: How to calculate the execution time of a Loop?

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. Smiley Very Happy

Message 10 of 14 (16,754 Views)