LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Evaluate CPU ussage of LabVIEW application on Windows 10

We are at the point where we want to start using an embedded computer to run our LabVIEW data acquisition, calibration, and control application. In doing so we want to standardize as much as possible. I want to gauge how much CPU our application uses in order to make sure we get an embedded computer with an appropriate CPU. What would be a good way to measure the CPU usage? And also how would I know how much LabVIEW is taking advantage of multiple cores?

It would especially be useful if there is a program out there that could analyze our application and tell me specifically what CPU models would be appropriate.

0 Kudos
Message 1 of 6
(2,968 Views)

Today's computers are extremely powerful and if CPU use is an issues, it is typically dues to faulty programming (e.g. greedy loops).

 

Does your application use any heavy math (transforms, linear algebra, nonlinear fitting)? Does it deal with massive amounts of data (very fast DAQ, image processing, etc.). What are the timing requirements? Are they all fulfilled?

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

You have a couple options to do this.

 

  1. The easiest way is to make a system call to "TASKLIST".  It is straightforward and simple but, has a bit more overhead than option 2.
  2. Make calls to the Windows Process Status API.  I find making .NET API calls cumbersome in LabVIEW, but it will be faster and in the end likely more reliable.

 

As for viewing multiple core usage and optimization, I don't know of any way to monitor that programmatcially.  It can be done with Task Manager, so I suspect it is possible to do through an API call, but haven't ever looked into it.

 

Edit:  And I agree with Altenbach that if you have issues it likely is faulty programming... but any more I always add a simple CPU / memory usage monitor into any application that does control on a 5-10 second timer.  It is nice to just have an extra monitor that will gracefully shutdown the system on the off chance I have a memory leak or if a virus  antivirus software kicks in and start hogging all of my resources.

0 Kudos
Message 3 of 6
(2,961 Views)

Is the "embedded computer" just a built-in W10 computer with GUI and all that (monitor, keyboard, mouse), or is it "really" embedded, using a realtime OS and e.g. LabVIEW RT?

If you just look at the task manager while the application is running, do you even see the CPU usage or is it near zero? (right-click the CPU graph and "change graph to logical processors" to see all CPU cores separately). Your application should not use any CPU while not doing anything and if the demands are in very short bursts, task manager will probably not really show it.

0 Kudos
Message 4 of 6
(2,946 Views)

I am looking for (in altenback's words) "a built-in W10 computer with GUI." Looking at task manager shows that my EXE uses 72% CPU on an i5-7200U. I normally sample at 100 S/s but want to be able to do 1000 S/s so I will use 1000 S/s as a standard in this thread unless otherwise stated. The application is mostly simple math in order to calibrate the acquired data of typically 6 or 7 channels. It is true that my program is not written in an optimal architecture. Besides having my UI in the same loop as the acquisition (I can fix this by using a producer consumer architecture using either channel wires or queues) I have my DAQmx read VI in a small while loop with no delay (picture attached). This is because I want to process the samples as soon as possible when they arrive; they should be processed within a maximum of 20 ms of arriving. If I put a delay of even 1 ms in the loop, just moving my cursor around the screen slows the loop down to much even if I use channel wires to get the UI into a separate loop from the acquisition loop. Any suggestions to improve on this would be appreciated.

 

 

I am also running this program on a small Acer laptop with a Pentium N3710 processor (according to this passmark benchmark this is just a bit more powerful than the Celeron N3160 which is in the UDOO X86 Advanced Plus) and it's CPU runs maxed out with the EXE taking about 90%. However, the CPU usage drops sometimes for a second or two (task manager screenshot attached) and during that time it looks like the program slows way down. Could this be the CPU getting to hot? Why is the CPU dropping out like this?

 

 

@BowenM Would you mind attaching a small example of using the system calls? I understand if you don't have time. Thanks for the suggestions. Do they show much more information than Task Manager shows?

Download All
0 Kudos
Message 5 of 6
(2,894 Views)

Hi Jonathan,

 

my EXE uses 72% CPU on an i5-7200U. I normally sample at 100 S/s but want to be able to do 1000 S/s

Using 72% CPU for processing 100S/s of 7 channels is ridiculous…

How do you setup your DAQmx task?

How many samples do you acquire per DAQmxRead call? (You used "N channels N samples" mode.) Answer: you read "as much as available yet" - which is wrong in my opinion for your task…

Which (DAQmx) hardware do you use?

 

The application is mostly simple math in order to calibrate the acquired data

You could (maybe) use DAQmx scales to have the "calibration" (rather "scaling") done by DAQmx…

 

I have my DAQmx read VI in a small while loop with no delay

Which is fine as soon as you set a sampling rate and request a fixed amount of samples: now DAQmx will determine the loop rate!

 

they should be processed within a maximum of 20 ms of arriving.

Set your sample rate of 1kS/s and read 10 samples per DAQmx call. This will need 10ms, more than enough to process those 10 samples per channel in parallel to waiting for the next 10 samples…

 

I guess you know all this.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 6
(2,888 Views)