05-14-2009 10:47 PM
05-14-2009 10:52 PM
05-14-2009 10:59 PM - edited 05-14-2009 11:00 PM
That's a bit too simplistic. One needs to take into account that you want to take the start time before anything else executes, and the end time after everything in the loop has executed. You also need to eliminate the loop delay. This is one of those (few) cases where a sequence frame is actually useful. Here's a simple implementation:
As to the question: You will only be able to get an average, and this may vary with time if you're not running on a real-time OS. Are you running this on a real-time OS?
05-14-2009 11:07 PM
thanks for replay
i dont have real time os i use window xp,but this will give me time for only one loop or for the hall no. of time for loop excution if it run continuasly.
05-14-2009 11:15 PM
You should not use the Run Continuously button unless you're in a special debugging situation. Obviously the code was intended as a demonstration. You can easily modify it if you want to, for example, get a running average, or get the average for N number of runs (would use a for-loop in this case).
Your question was a bit vague, so the suggestion was limited.
05-14-2009 11:43 PM
ok
in the attached file,i want to know how much time it takes to aquir and send for only one loop.
05-15-2009 12:29 AM - edited 05-15-2009 12:31 AM
I m not clear, do u want to calculate the loop time for one iteration? then remove the while loop and place the code in the stack sequence so as smercurio_fc suggested. find the attached screen shot,in the front pannel the loop time indicator will be updated with the corresponding loop time for every iteration. for example u stopped the while loop in the tenth iteration then the average loop time will calculate the average of ten loop times and returns the average time of your loop
05-15-2009 12:48 AM
Away from the topic..
never do file write in the loop which performs time strigent operation which will introduce jitter in the loop and average time will be a mess. If you wish to build a deterministic loop pull out the write from the loop and follow the parallel loop architecture (jus search in the forum) to implement the file write.
The solution provided in the previous post is apt for calculating the loop time.
05-15-2009 01:32 AM