LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

CPU usage is 98% when running my exe labview program

Hi
I have made an executable and installer for my labview program. When I install and run, the program uses a lot of cpu - almost 100%, even when the program is not computing. I recently changed over to LVIEW 8.2 from LVIEW 7.1. I had none of these issues with 7.1.
 
Programatically, I use a state machine to continuously execute the program. I also use a couple of while loops as slaves to plot the results processed in the main loop. In all while loops I have a 'Wait' until next ms' vi to prevent the program using all the cpu, but it doesnt seem to be helping in LVIEW 8.2. This is somewhat strange.
 
Can someone suggest what may be happening? and are there any methods that I can use to reduce cpu usage of my program?
 
Cheers
 
RVR
0 Kudos
Message 1 of 15
(9,967 Views)
It will be impossible to really troubleshoot this without a lot of additional infomation.
  • Is the CPU usage only high in the built application, or is it also high if you run the same program in the 8.2 development environment?
  • Was the 7.1 program exactly the same, or did you make any modifications since?
  • Are you running 8.20 or did you upgrade to 8.2.1?
  • What does the program actually do? Does it interact with DAQ hardware? File I/O?
  • What does the program do when it is "computing"? Is the CPU use even higher then?
  • Is there also a wait statement in the main while loop?
  • What is your OS (windows, linux, mac, etc.)
  • Is your computer reasonable for the task. Enough RAM, etc.
  • How do the various loops communicate with each other? (queues, local-, global-, shared- variables, etc.)
  • How much data is exchanged between the loops? At what rate?
  • Do you use fixed or variable size arrays?
  • Can you give us a more detailed overview of the code?
  • How is the memory usage?
  • have you done any profiling?

 

Message 2 of 15
(9,956 Views)

- cpu usage is high in both the built and labview environments

- 7.1 program was the same, except for some changed vi's which were replaced in 8.2

- running 8.2.1

- program does not interact with daq or any other hardware. it is basically processing statistical algorithms

- the cpu usage is higher when 'computing' but is very high - around 95 - 98% when 'idle'

- there is a wait statement in the main loop of 400ms

-running windows XP

-computers has 1Gb (desktop) and 2Gb (laptop) RAM

-loops communicate using locals

- data exchage in loops varies - not sure what rate...

- both fixed and variable size

- not sure how to check memory usage and i have done the memory profiling but not sure how to analyse the results or improve code based on this analysis.

 

Cheers

0 Kudos
Message 3 of 15
(9,944 Views)

Hi, to learn more about the use of the profiler you can look here. Consider the information given under the point Profile Data to sort the results.
Hope this helps,
Dave

 
Greets, Dave
0 Kudos
Message 4 of 15
(9,928 Views)
Profiling would certainly help pinpoint the offending subVI. It would be hard to believe that all modules contribute to the high CPU usage. Try to isolate the problem as much as possible.
 
(A more primitive overall look at memory usage would be looking at the windows task manager and "VI properties...memory usage". Is it exceptionally high? Growing with time? )
 
Does the statistical analysis take about the same amount of time as it did under 7.1 or does it take longer now?
 
It is also possible that some of the math routines have changed, so there could be differences. Do you have more details on the analysis?
 
Use of local variables always has the danger of race conditions. It could simply be that execution order has slightly changed since the upgrade and a race condition causes a much heavier CPU load.
 
 
Message 5 of 15
(9,901 Views)

Thank you for all your help and suggestions Altenbach. i will work through that now and try to isolate the problem.

Best wishes

RVR

0 Kudos
Message 6 of 15
(9,865 Views)
Thank you.
0 Kudos
Message 7 of 15
(9,864 Views)

i also have a problem in labview 6.1 ...........when i execute the 2-3 programs continuosly using load and run functions the program continuously it shows 100% cpu utilisation?

0 Kudos
Message 8 of 15
(6,906 Views)

@priya2207 wrote:

i also have a problem in labview 6.1 ...........when i execute the 2-3 programs continuosly using load and run functions the program continuously it shows 100% cpu utilisation?


What is a 2-3 program? What are "load" and "run" functions? Du you use the "run continuously" function? (you use that term twice in the same sentence)!

 

It is normal for a program to use 100% CPU if it does not contain any small wait statements, but simply runs over and over as fast as the CPU allows. Such a program is poorly written.

 

In any case, if you want more detailed help, please atttach some code. Of course LabVIEW 6.1 is ancient.

0 Kudos
Message 9 of 15
(6,890 Views)

iam attaching the code..........in this code main objective is to load and run 3 vis simultaneously using semaphore syncronisation..... these vis have several other subvis also...100% cpu utilisation is due to bad programming or there are some other reasons also

0 Kudos
Message 10 of 15
(6,856 Views)