LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

CPU being consumed by drawing routine?

Hi,
 
I built the attached VI because I noticed a problem within a larger application I am writing,
where a User interacts with a front-panel Picture control (mouse events etc).
Responsiveness to front panel events got progressively worse with time.
 
I tracked the problem down to the "Draw Multiple Lines.vi" (or at least the way that I am calling it).
 
Example: The attached VI repeatedly calls "Draw Multiple Lines.vi" with a timed delay of 50msec between calls.
On my PC, after running this VI for a few minutes within the LabVIEW development environment
the amount of CPU being consumed (as observed using Windows Task manager) is seen to progressively rise,
initially from about 5% until eventually the VI consumes 50% of available CPU time.
 
Can someone explain what is happening here and how I can ensure CPU-hogging doesn't happen?
 
0 Kudos
Message 1 of 4
(2,669 Views)

Hi AQ1,

i don´t see this behavior. You don´t need the local variable! Smiley Wink For more information see Darren´s Nugget about the picture control.

http://forums.ni.com/ni/board/message?board.id=170&message.id=212920

Hope it helps.
Mike



Message Edited by MikeS81 on 07-08-2008 01:14 PM
Message 2 of 4
(2,655 Views)
I do see the behavior (after a few minutes of running) and I also think the problem is with the local variable. A picture control wire is a string of drawing commands. When you use the local variables, you append the same commands over and over again into this string and the picture control has to draw more and more instructions (which requires more CPU cycles) . You can see this if you flatten the picture wire to a string.

___________________
Try to take over the world!
Message 3 of 4
(2,650 Views)

If you are using the local because you want to preserve what is already in the picture then makes sure "erase first" is off.

This will only update the portion of the screen that is modified with the new info passed to the picture.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 4
(2,632 Views)