sahara agrasen Posted October 29, 2007 Report Share Posted October 29, 2007 hi to all i need to learn about all the timer loops and especially the tick count... I would like to learn..that if say i want to know the execution time of a while loop..and need to get the difference of my previous sample and next sample...how to implement it?.. can anybody help me or explain it to me with one short and sweet example... I much thankful to him/her if i wil get the answers from u people... Sahara Quote Link to comment
Karissap Posted October 31, 2007 Report Share Posted October 31, 2007 If you want to know the execution time your while loop takes you can use a shift register to calculate the difference in time. Here is an example using "Get Date/Time in Seconds.vi" and "Tick Count (ms).vi". The method that uses the get date/time will use more processor time than the tick count method. However, if you use the tick count method the counter will wrap back around to zero at some point so you will get an error eventually if you run it for a long time (will wrap around once every 50 days). Download File:post-8228-1193724740.vi I don't know if this is what you are after or if you wanted help using the timed-loop structure. Quote Link to comment
Mellroth Posted October 31, 2007 Report Share Posted October 31, 2007 QUOTE(Karissap @ Oct 30 2007, 07:15 AM) ...However, if you use the tick count method the counter will wrap back around to zero at some point so you will get an error eventually if you run it for a long time (will wrap around once every 50 days)... The wrapping of the U32 tick count value is not an issue, unless one iteration is taking more than 2^32 ms to complete. In other words: A-B, where A and B are U32 values, will still be correct even if A wrapped (unless the real difference is greater than 2^32). /J Quote Link to comment
carlover Posted November 16, 2007 Report Share Posted November 16, 2007 QUOTE(Karissap @ Oct 30 2007, 06:15 AM) Download File:post-8228-1193724740.vi Why use of shift registers for initial time "stamp" (are there any performance benefits, or...?). If you just connect initial seconds count to the while loop boundary every time loop iterates it will get same value; that would eliminate need to carry "non-changing" variable through the loop and shift registers. or am I missing something? Quote Link to comment
eaolson Posted November 16, 2007 Report Share Posted November 16, 2007 QUOTE(carlover @ Nov 15 2007, 11:11 AM) Why use of shift registers for initial time "stamp" (are there any performance benefits, or...?). If you just connect initial seconds count to the while loop boundary every time loop iterates it will get same value; that would eliminate need to carry "non-changing" variable through the loop and shift registers. or am I missing something? What you suggest would give you the total time elapsed in the loop. The way it's written now gives you the elapsed time of each iteration of the loop. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.