LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

100% CPU Usage caused by HMI

Hi everybody:

I'm working with LabVIEW DSC 8.2.1 in a system that monitors many variables of a plant, such a typical SCADA system. For this reason, the use of the graphic tools is highly used on the development of this system. Everything works fine, but I have only one problem.... the usage of the CPU.
When I am working on the development system I (not the executable) I start the application and after the variables are initialized and every process has started and are running , the CPU usage is raised around 90 - 100%. After a few days investigating the reason of this, I realized thay when I change the view on the screen to another view, for example the block diagram of the application, while the application is still running, the CPU usage goes around 15 - 25%. I've tried these many times changing the view from Front panel to Block Diagram and viceversa and the result is always the same: Front Panel= around 100%; Block diagram or another view (other applications MMIs, or Block Diagrams, etc.)= around 20%.

Another thing that I realized is that the other view (different to front panel) has to fill the entire screen to work the way I'm telling before.

When I build and run the executable, the usage of the CPU is the same... (around 100%), but I can't see any other application, because the application built is the shell of the OS, so no other views are available.

I don't know if there's some other consideration to take into account about the HMI when creating an application, and I'll appreciate very much your help.

Thanks in advance!

Ignacio von Unger
0 Kudos
Message 1 of 11
(7,733 Views)
If your program has a While Loop with no kind of delay (like a Wait function) then it will consume 100% of your CPU. Even adding a wait of 10ms will help greatly.

If you post your code, someone might be able to help more.

Smiley Wink
Message 2 of 11
(7,722 Views)
Other than the wait advice, this probably means that updating something on the front panel causes this.

I would suggest that you start by enabling the scrollbars in the FP and move them around to see if the usage drops. If this works, you should be able to tell what's the source of the problem. Please note that if you have a tab control, sometimes updating things in non-visible pages of the tab can cause this.

A couple of potential culprits are bound controls (Datasocket or shared variables) and updating the strings of a ring inside an array.

___________________
Try to take over the world!
0 Kudos
Message 3 of 11
(7,715 Views)
 From http://100cpuusage.blogspot.com/

100 Percent CPU Usage when you run programs after you install Windows XP Service Pack 2


CPU Usage 100% Symptoms

When you run some programs, the CPU Usage meter in Task Manager may indicate CPU Usage 100%. When CPU utilization reaches 100 percent, programs will run very slowly or stop responding (hang) and your computer is freezing or crashing.
Note:Press CTRL+ALT+DEL to view CPU utilization, click Task Manager, and then click the Performance tab.
These symptoms occur after you install Microsoft Windows XP Service Pack 2 (SP2).

CPU Usage 100% Cause

These problem occurs because of the user interface code that is included in Windows XP SP2. The high CPU utilization is caused by the additional overhead that occurs when the IsWindow function is called by the user interface code.

RESOLUTION

Hotfix information

A supported hotfix is now available from Microsoft. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hotfix only to systems that are experiencing this specific problem. This hotfix might receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next service pack that contains this hotfix.
To resolve this problem, submit a request to Microsoft Online Customer Services to obtain the hotfix. To submit an online request to obtain the hotfix, visit the following Microsoft Web site:
http://go.microsoft.com/?linkid=6294451
Note If additional issues occur or any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. To create a separate service request, visit the following Microsoft Web site:
http://support.microsoft.com/contactus/?ws=support (http://support.microsoft.com/contactus/?ws=support)

Prerequisites
To apply this hotfix, you must have Windows XP SP2 installed.

Restart requirement
You must restart the computer after you apply this hotfix.

Hotfix replacement information
This hotfix does not replace any other hotfixes.

File information
The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel. Date Time Version Size File name
--------------------------------------------------------------
30-Mar-2005 19:53 5.1.2600.2643 577,024 User32.dll
30-Mar-2005 01:30 5.1.2600.2643 1,836,544 Win32k.sys

if you still do not know how to Fix CPU Usage 100%?

I suggest you try targeted software - registry cleaner to fix cpu usage 100%
Because there are many cases causing high cpu utilization.
1. If you do a lot of web surfing and are concerned about spyware, adware infecting your machine, they will cause system crashes and CPU utilization reaches 100 percent. Some good registry cleaner has the function of spyware & adware removal.
2. You install many beta version of the software, Drivers are not certified, which resulted in many errors, you get high cpu usage.
3.100% CPU Usage while you use Internet Explorer
4. many unneed Startup Program.
5.Others PC Errors. - DLL errors, runtime errors, Windows-Installer Errors, Windows Startup Errors,paths Broken DLLs, OCX, and ActiveX Components all will cause 100% cpu usage. Your PC will run very slowly.

Registry cleaner can do a complete scan of your entire file system and registry in under 2 minutes! Fix High Cpu Usage. Improve PC Speed By Up to 70%!

http://www.100-cpu-usage.com/ suggest you to download registry cleaner to fix 100% cpu usage too.
PCErrorsfixer.com - Top 3 Windows Registry Cleaners, Improve PC Performance,5 Star Rated. Fix 100% CPU Usage, Runtime Error, DLL Error,Windows Startup Errors,Internet Explorer Errors, Speed Up your slow PC.
0 Kudos
Message 4 of 11
(7,592 Views)

This looks an awful lot like spam!Smiley Mad

Besides the bad English which doesn't give any confidence that this is professional software,  lungli had just created an NI account today and advertises a homepage that seems like it is affiliated with the solicitation.

 

 



Message Edited by Ravens Fan on 01-02-2008 09:56 PM
0 Kudos
Message 5 of 11
(7,585 Views)
Thanks everybody for your help and your hints.
For security reasons I can't post the code, but thanks anyway for your help "LabViewGuruWannabe".
Now, concerning to the comment posted by "tst", I focused my research on that way and guess what.... I FOUND THE REASON! and of course I've already fixed it; it was a periodically calling (and updating) to a MMI indicator vía control reference; I vas passing the control's reference to a vi and this vi was updating the data (and properties) of this control too fast, so I've decided to update these data only when a change has ocurred on one or more of these data and after this the CPU usage was around 15%.

Thanks a lot!

Ignacio von Unger
0 Kudos
Message 6 of 11
(7,557 Views)
Can you provide details? Specifically, what kind of control (and properties) was it and what is "too fast"? Did you have a loop with no wait or is something like 10 Hz also too fast?

___________________
Try to take over the world!
0 Kudos
Message 7 of 11
(7,533 Views)
sure, the control was a Multicolumn ListBox, and the properties were the color of the font of the active cell.
The problem was that the quantity of rows were 50, and the color of EVERY one of them was changed, by means of a "for" loop every 1 sec. The quantity of rows is the input "N" of the "for" loop, the "i" variable of the for loop is the index of the active row; and for every one of the rows, its font color is set with a time delay, between each iteration, of 1 msec. This "for" loop was executed periodically every 1 sec, and that caused the near 100% CPU usage. When I changed the code in order that the loop was excecuted only if a change on the data of the Listbox is detected, the usage of the CPU declined to near 15 - 20%.

Maybe there's even a better way to perform this, but up to now, with or without the vi with this logic, on tne main vi, the CPU usage is almost the same.

Hope this could help to anybody

Thanks again!

Ignacio von Unger
0 Kudos
Message 8 of 11
(7,514 Views)
"... the color of the font of the active cell.
The problem was that the quantity of rows were 50, ..."
 
If you first set defer FP updates before starting the updates and then un-defer after, you will see a big difference in performance.
 
When FP updates are NOT defered, LV will attempt to update the GUI after each update.
 
When the FP updates are defered, the changes are just applied once* at the end.
 
Ben
 
* As of LV 7.0 or there-abouts, the defer, when set true will force an update once before the deferment goes into effect.
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 11
(7,507 Views)
Yes, it makes sense thatn this would cause high CPU usage.

As Ben mentioned, defer panel updates should help. Here's an example of how to encapsulate it nicely into a subVI.

___________________
Try to take over the world!
0 Kudos
Message 10 of 11
(7,501 Views)