LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview eating up CPU time

I am running a program (LV 7.1) which has several VIs running concurrently.  It is a self-made server-client architecture utilizing TCP/IP communication protocol.  When the program is running with all of the VIs executing simultaneously and the client sending TCP/IP requests to the server, my whole computer starts to freeze (CPU usage shows 100%) and the TCP/IP communication times out.  The program was running fine when I made some simple changes and then it started to behave as above.  I went back to previous versions of the program and they are now acting the same way.  I can load the program on another machine and it runs fine.  I reloaded Labveiw 7.1, no change.  I am running Windows XP Professional, version 2002 with service pack 2.  I have a Xeon 3.6 GHz CPU with 3 GB RAM.  I tried the program on several other far less powerful machines and it works fine.  Any suggestions would be appreciated.
0 Kudos
Message 1 of 6
(3,016 Views)

If you have any loops, be sure that there is some delay in each of them.  Even 1mS delay is enough.  100% CPU time is a symptom loops without delays in them.

Message Edited by tbob on 08-15-2007 01:20 PM

- tbob

Inventor of the WORM Global
0 Kudos
Message 2 of 6
(3,006 Views)
If it runs fine on any other computer, ther might be something wrong with the network (adapter, driver, cable).
 
Do you run any kind of personal firewall software, for example? Are you sure the other computer is reachable?
0 Kudos
Message 3 of 6
(2,988 Views)

Right now I am just testing it out on my desktop and running the server and the client on the same computer.  I tried disconnecting the computer from the network while running with no help.

thanks

0 Kudos
Message 4 of 6
(2,973 Views)
Just to be clear. It is LabVIEW that is consuming all the CPU cycles, yes?
  • Try taking our parts of the code and try running it to see if you can narrow-down a logical subsystem that could be the result.
  • Make sure there aren't any unhandled errors. A loop can run much faster if all the VIs in it are essentially disable due to an incoming error.
  • Try running the code with execution highlighting turned on and see when the excessive CPU utilization starts.
Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 5 of 6
(2,961 Views)
I would start by placing a delay (as others suggested) in your client VI. Place a probe on the error out of the TCP Open in the client VI and check for errors there. Look for error code 60.

It sounds as if your are opening and closing ports quickly. There are a finite number concurrent TCP/IP ports available from the OS. If they are not closed properly, they will need to time out before the OS closes it. Your CPU load may be pegging becuase you are flooding the TCP stack with open connection requests and you've max'd out the connections.

If the error is indeed 60, then you should handle that gracefully in your client (maybe a dialog box with a message 'sever not accepting connections; retry or abort'). If your design includes frequent TCP open and close ( > 1 per second) you may want to consider opening a more persistent connection; store the Connection ID in a shift register or a functional global and only close it when you are done communcating with the server.

See this post: http://forums.ni.com/ni/board/message?board.id=170&message.id=240177&query.id=349798#M240177

Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

0 Kudos
Message 6 of 6
(2,930 Views)