NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Time of execution of steps

Solved!
Go to solution

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. 

0 Kudos
Message 1 of 15
(6,145 Views)
Solution
Accepted by topic author Kulwant

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

Message 2 of 15
(6,141 Views)

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

Message 3 of 15
(6,108 Views)

Thanks very much bruno  for solution and thanks Evanp for more insight into the solution..... \

 

Regards

kulwant singh

R&D Engineer 

Agilent Technologies

0 Kudos
Message 4 of 15
(6,102 Views)

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

0 Kudos
Message 5 of 15
(5,640 Views)

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, 

0 Kudos
Message 6 of 15
(5,583 Views)

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

Download All
0 Kudos
Message 7 of 15
(5,575 Views)
Some more information - when I step through the code it is showing Locals.Step_Index = 11, but if I look at Locals.ResultList it is only showing 8 elements (0-7) - how do the elements in ResultList correspond to the step index?  Element 7 shows an Index = 11, and it has a StepName of the step I want to measure....
0 Kudos
Message 8 of 15
(5,574 Views)

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

0 Kudos
Message 9 of 15
(5,568 Views)

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,

0 Kudos
Message 10 of 15
(5,565 Views)