NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


Reply
Member
Rashid931
Posts: 56
0 Kudos
Accepted 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

Proven Zealot
muks
Posts: 6,710

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

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

Knight of NI
Posts: 18,064

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

Member FHM
Member
FHM
Posts: 67

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

I hope I got your question! See attached screenshot

Member
Rashid931
Posts: 56
0 Kudos

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

Proven Zealot
muks
Posts: 6,710

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

Rashid,

 

Check this.

Member
Rashid931
Posts: 56
0 Kudos

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

Knight of NI
altenbach
Posts: 22,851

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. :smileyvery-happy:


LabVIEW Champion . Oh, by the way, I work for peanutsKudos .

Member
Rashid931
Posts: 56
0 Kudos

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

Hi altenbach,

 

                Kindly explain. I did not get you.

 

Thanks and Regards,

 

Rashid

Knight of NI
altenbach
Posts: 22,851

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. :smileyvery-happy:


LabVIEW Champion . Oh, by the way, I work for peanutsKudos .

By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page