LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need wait less than 1 ms.

Solved!
Go to solution

I have an application that is performing Bit Error Rate testing.  It automatically loads VITs into different cores to maximize thoughput.  It works great.  In one of the cores, I need the sending of data to be throttled because it it sending data too fast.  As you know, if you are running simultaneous loops, you routinely add a 1ms wait in a loop to keep it from hogging the compute cycles and allows other asyncronous loops to procede.  My problem is that adding 1ms is too much time and slows things down severely.

 

While I have though of adding a do nothing loop with a varying number of iterations, I think that will impact performance in the other loops while it is iterating.  Is there a way to generate a smaller wait than 1ms, but with the same effect, namely allowing other loops to run in the idle time.  The amount of computation the other loops are performing requires a substantial amount of the bandwidth available in a single core.

 

I am sending hundreds of thousands of characters a second out using a loop.  If I add 1ms. to each iteration, my throughput drops to 1K.

 

I am contemplating a counter that would insert a 1ms wait only every 10 to 100 iterations.

 

Anybody have any experience, or good ideas?

 

 

0 Kudos
Message 1 of 7
(3,838 Views)

The timing VIs use calls to windows to monitor the PC's millisecond timer.  Therefore you cannot receive any time granularity less than a ms.

 

A 1ms wait every once in a while can allow other loops/processes to catch up, but it will go back to hogging the CPU after the 1ms.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 2 of 7
(3,818 Views)

You can also add a wait of 0 msec.  It will allow the loop to run fast, but prevents a loop from hogging all the CPU resources.

 

You really can't have good control of timing in a Windows environment.  Even a 1 msec wait is not a reliable amount of time.  If you need fast loops, but at a deterministic rate, you might have to run your code on a real time operating system.

0 Kudos
Message 3 of 7
(3,816 Views)

I pretty much figured as much.  I will do the insert every X numbers of cycles.  I will monitor the rate and adjust the insertion to maintain an anverage throughput. 

 

I will keep a wait=0 in every iteration to prevent hogging, but only add waits to maintain the throughput.

 

I will post back up how it works.

0 Kudos
Message 4 of 7
(3,808 Views)
If you know a minimum rate that the loop needs to run (or a maximum) you can monitor that rate every time you get to your 1ms Wait case. If it's going way fast, you can delay more perhaps. If it's going too slow, you could not do the Wait.

You're walking a fine line and your code will be racing itself the whole time. If you need timing less than 1ms and this doesn't work, Windows is the limitation and you would need to add in some Realtime hardware.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 5 of 7
(3,796 Views)
Solution
Accepted by topic author oldmanXJ

That is exactly what I was trying to say.  It's nothing more than a servo loop.  You have to adjust the coefficients to keep it stable or it will oscillate wildly. 

Message 6 of 7
(3,788 Views)

While I don't have any advice for you, I am interested in your application. Having recently had to do some BERT myself I was searching for a LabVIEW solution. We have some hardware from Spirent here that does BERT, but found it uses PRBS and our customer was a little skeptical of that fact.

 

Anyway if your code is not something proprietary I would like to see it.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 7 of 7
(3,767 Views)