LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Updating scroll position in the string control costs too much CPU - performance

The dynamic updating of the scroll position in the string control costs too much CPU - performance. Is there a smart way to avoid this?
I use the text scroll position of the string control to adjust the string control dynamically. I use this function in a VI, which traces messages. The CPU performance is almost higher than tracing messages without updating the scroll position inthe string control.
Is it a problem of the programming or a general problem of WINDOWS?
0 Kudos
Message 1 of 9
(3,475 Views)
I don't see that problem. Do you use an untimed loop to update the scroll position? If you have a loop polling the string size and setting the scroll position, use a wait of at least a few milliseconds in it.
0 Kudos
Message 2 of 9
(3,472 Views)
The loop is timed with a few milliseconds, but if the text updates very often, the cpu performance remains up to 100%.
If I don't use the set scroll position in this phase, the cpu performance remains to 55%, only.
0 Kudos
Message 3 of 9
(3,459 Views)
How big is the string, and how much of it is visible at once?

Shane
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 4 of 9
(3,458 Views)
The whole string is up to 20kB large. If this size exceeds, the software appends the string into a text file. Then the string starts agein with 0kB, collecting SPI messages at a device.
The visible part of the string is about 24 lines long (please see attached image).
0 Kudos
Message 5 of 9
(3,451 Views)
Concatening strings of that size is quite slow, so is updating the scroll position. Can't you write to the file more often to clear the string?
What might help is having a 20kB string preallocated, wire it to a shift register and just replace string subset. You'll need an additional shift register for the current position to know where to insert the new data and to which position to set the ScrollPos.

0 Kudos
Message 6 of 9
(3,437 Views)

Three thoughts;

1) It looks like you are using more memory than you have physical memory. Page Faulting could be an issue. Try increassing memory.

2) Admitidly it is more work but... a picture control would only require an update of the part of the screen where the data has changed...

3) Minimize the screen update freq.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 7 of 9
(3,426 Views)
@ Ben

What do you exactly mean with picture control?
0 Kudos
Message 8 of 9
(3,417 Views)

Hi Jon,

A couple of years ago I developed a mock-up of a protocol analyzer screen where I displayed transmit and receive data in alternating lines of the display.

I did this using the picture controls ability to just update a portion of the display area and not having to completely re-draw everything.

I tracked were the next line of text should be inserted handled the screen updates explicitly.

This gave me much better performance than using a string control once the data set grew.

I am not at liberty to share that code.

The LV Picture Control thread found here

http://forums.ni.com/ni/board/message?board.id=BreakPoint&message.id=14&jump=true

In post #25 I give you a link to an example where I do something similar to what I did for the protocol analyzer, only side-ways.

I hope this helps,

 

Ben

 

Message Edited by Ben on 09-20-2006 08:54 AM

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