10-14-2008 03:06 AM
hello
i want to use the stop watch or timer to note the time of completing few step (say time taken by three steps in a sequence.)
how can i do that i did not find an timerin ts.
Solved! Go to Solution.
10-14-2008 04:40 AM
Hi,
You can add a statement step before your steps, with the expression : Locals.intialTime = Seconds ().
After your steps, the expression for the execution time is : Locals.executionTime = Seconds() - Locals.initialTime.
The result is in seconds.
Bruno
10-16-2008
01:58 AM
- last edited on
11-05-2024
01:43 PM
by
Content Cleaner
Also keep in mind that TestStand saves the time that a step begins execution (Locals.ResultList[<step index>].TS.StartTime) as well as the total step execution time (Locals.ResultList[<step index>].TS.TotalTime) in the TS container. This TS container is a subproperty for each step copied to the Locals.ResultList container during execution, which includes all steps by default.
The accuracy of these timestamp values is similar to the Seconds() Expression Function that Bruno mentioned and is 1 millisecond or better depending on lower level factors like your CPU.
Evan Prothro
RF Systems Engineer | NI
10-16-2008 02:47 AM
Thanks very much bruno for solution and thanks Evanp for more insight into the solution..... \
Regards
kulwant singh
R&D Engineer
Agilent Technologies
02-22-2010 03:58 PM
Hi - your solution about the time to execute a module is what I'm needing to do on a test I'm working on, but I'm not sure how to do it. I'm using TestStand 3.5.
My first question is how to get the step index - I tried putting in a post expression on the step whose execution time I wanted to measure of "Locals.Step_Index = RunState.Sequence.Locals.Step_Index" but my number Locals.Step_Index remains 0.
Once I can get the step index, how do I use that to get the time? I was thinking it'd be: "Locals.Step_Execution_Time = Locals.ResultList[Locals.Step_Index].TS.TotalTime"?
Thanks!
-Bill Hilliard
02-25-2010 10:49 AM
Hi Bill,
The TS container for the step isn't available until the step is completed. So you can use a local variable to keep track of the step index like this: Locals.StepIndex = RunState.index. This would be the Post Expression in the step your interested in timing. Then to get the execution time of that step in later steps you can access the TS Container like this: Locals.ResultList[Locals.StepIndex].Ts.TotalTime.
Cheers,
02-25-2010 12:16 PM
Michael, thanks for the response. I'm still having problems though...
On getting the index, I had to use RunState.StepIndex - RunState.index didn't work.
When I try to use that though, I'm not having any success. If I use Locals.ResultList[Locals.StepIndex].Ts.TotalTime I get an error. I also tried .TS with no success. The attached pictures show the details. Pic1.jpg shows the Error using "Ts", Pic2.jpg shows the error using "TS." You can't see it in the screen shot, but the step above the breakpoint is where the post expression gets saved to Locals.Step_Index - the watch window shows that having a value of 11.
Pic3.jpg shows the error I get if I hit the check expression for errors button on the step with the breakpoint.
Am I putting something in incorrectly?
Thanks,
-Bill
02-25-2010 12:22 PM
02-25-2010 12:33 PM
Some more info 🙂 I changed the index of step with the breakpoint to Locals.Step_Index - 4, and the first time the loop executed, it works. But for the 2nd iteration of the loop, Locals.Step_Index didn't change. If I look in the watch window at Locals.ResultList[most recent index of step].TS.Index, it still shows 11, but that means it goes back to the earlier index, which had a different TotalTime.
The Id and StepId appear to be unique - is there some way to do this using those?
Thanks,
-Bill
02-25-2010 12:39 PM
Hi Bill,
In the post expression of the step that you are interested in measuring, save the Step Index to a local variable like you have. You are correct in that it should be RunState.StepIndex. The error you are seeing in your third image is expected. This statement is valid until run-time. That is, the Ts container doesn't exist until run-time.
Cheers,