NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

seconds() function issue on Quad Core CPU

Hello,

 

I am noticing some timing issues using Seconds() function on a Quad Core computer. The optional boolean in Seconds() is True (by default). 

With Core 2 Duo CPUs, the seconds() function is reporting elapsed time (since TestStand startup) correctly. However, I noticed on a Quad Core CPU that the seconds(True) function reports ~0.5s every 1 second. In other words, seconds() elapsed is incorrectly reported. Has anyone observed such issue?

 

When the boolean parameter is set to False [i.e. Seconds(False)], there is no problem observed on Quad Core CPU.

0 Kudos
Message 1 of 16
(5,248 Views)

Just to add:

 

I'm using TestStand 3.5 on Windows XP.

 

thanks,

0 Kudos
Message 2 of 16
(5,247 Views)

Howdy Troy,

 

I don't have a quad core to duplicate your issue, but it sounds plausible. Since this is an older version of TestStand that was developed before multicores went mainstream, this very well may be expected behavior.

 

You might instead call directly into the Windows API using kernel32.dll--particularly one of these functions:

 

GetSystemTime

GetSystemTimes (for multicore)

GetTickCount

 

External Link: MSDN: Time Functions (Windows)

 

Judging from the nature of your question, I think GetTickCount would suit you best.

 

I hope this helps!

 

 

Warm regards,

pBerg
0 Kudos
Message 3 of 16
(5,203 Views)

Troy -

 

Are you using a Laptop?

Manooch H.
National Instruments
0 Kudos
Message 4 of 16
(5,182 Views)

No.  It's a desktop with the following config: Intel Core 2 Quad CPU (Q9400 @ 2.66 GHz).

 

0 Kudos
Message 5 of 16
(5,177 Views)

Troy -

 

Please see the following forum thread which I believe to be related to the problem you're seeing. I think the workaround mentioned in this thread by dug9000 (see accepted solution) might be beneficial to you if you are willing to try it.

 

Wrong Wait() step execution time

Manooch H.
National Instruments
0 Kudos
Message 6 of 16
(5,163 Views)

There are issues on some hardware with the QueryPerformanceCounter() operating system API that TestStand uses. See the thread Manooch posted a link to for more information. I suspect the workaround in that thread will likely work for you as well. If you do try it, please let us know if it works.

 

Hope this helps,

-Doug

Message Edited by dug9000 on 11-18-2009 09:18 AM
0 Kudos
Message 7 of 16
(5,143 Views)

We are thinking of purchasing newer TestStand for our site. If we upgrade to newer TestStand version and still use Seconds() function, would that fix the problem?

 

Thanks.

Message 8 of 16
(4,997 Views)

This is not an issue with TestStand (other than that it is using the win32 API QueryPerformanceCounter()), it's an issue with certain hardware/BIOS/Windows OS combinations which cause this API to function incorrectly. When this API is not funcitioning correctly it can effect other software which relies on this win32 API too. The workaround in the other forum thread might help (it worked for at least one user with a similar problem), but there are some risks, so you will need to decide for yourself whether or not it's worth trying. You might also try contacting the manufacturer of your computer to see if they have a solution as well. Again, this should not happen on most machines. On most computers (even quad core) this API should work correctly.

 

Hope this helps,

-Doug

0 Kudos
Message 9 of 16
(4,951 Views)

Just want to let you know that it's interesting that passing false to Seconds() seems to avoid the issue. I looked into why and it's because TestStand uses a different win32 API (a different timer) in that case. I've recorded this as something to consider using as a potential permanent workaround to this issue in a future version of TestStand, however there are trade offs as QueryPerformanceCounter is a higher resolution API.

 

-Doug

0 Kudos
Message 10 of 16
(4,945 Views)