ni.com is currently experiencing unexpected issues.

Some services may be unavailable at this time.

取消
显示结果 
搜索替代 
您的意思是: 

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 项奖励
1 条消息(共 14 条)
53,770 次查看

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

2 条消息(共 14 条)
53,760 次查看
3 条消息(共 14 条)
53,753 次查看
解答
接受人 Rashid931

I hope I got your question! See attached screenshot

4 条消息(共 14 条)
53,747 次查看

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 项奖励
5 条消息(共 14 条)
53,745 次查看

Rashid,

 

Check this.

6 条消息(共 14 条)
53,724 次查看

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

 

Regards,

 

Rashid

0 项奖励
7 条消息(共 14 条)
53,723 次查看

> 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. 😄

8 条消息(共 14 条)
53,702 次查看

Hi altenbach,

 

                Kindly explain. I did not get you.

 

Thanks and Regards,

 

Rashid

0 项奖励
9 条消息(共 14 条)
53,698 次查看

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. 😄

10 条消息(共 14 条)
53,684 次查看