LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

CPU Optimisation

Hello everyone,

 

I am currently developing a program that displays computer information, such as CPU/GPU load & temperature. The idea is that the program will be running continuously, while games and other high-resource software is running. However, it seems that CPU usage is a bit high; peaking at around 20% utilisation.

 

Are there any ways I can cut down on CPU usage? I have tried messing around with the iteration delays, but haven't had much luck. I currently have multiple loops all doing different tasks at the same time. Would it be best to process everything sequentially (with a flat case structure, for example) or can I just let LabVIEW deal with the threading automatically? Also, are there any tools that would let me see CPU usage per VI or loop?

 

I have attached a screenshot of the VI, any help would be appreciated.

 

 

Thanks,

Ryan

0 Kudos
Message 1 of 14
(3,067 Views)

Doing a few things wrong.

 

Firstly, you're creating and destroying .NET objects in each loop iteration.  Create it once before the loop, pass the wire into the loop, make the measurements and then when exiting the loop, pass the wire out again (Make sure to wire it to shift registers) and only close it when the program is stopping.

 

Secondly, try not to use property nodes for reading FP values, use local variables instead.  It's a lot faster.

 

Just the first two things which occurred to me.

0 Kudos
Message 2 of 14
(3,063 Views)

I am having a hard time wrapping my head around why you would do something like this...

 

Nested While Loops.PNG

 

Nesting 4 infinite loops inside an infinite loop just doesn't compute.

---------------------------------------------
Certified LabVIEW Developer (CLD)
There are two ways to tell somebody thanks: Kudos and Marked Solutions
0 Kudos
Message 3 of 14
(3,051 Views)

They're not infinite loops, but the outermost loop is just not required at all.

0 Kudos
Message 4 of 14
(3,048 Views)

Is it really necessary to write something new?

There are tons of ready to use programs available for that use case, like MSI Afterburner to name only one.

0 Kudos
Message 5 of 14
(3,036 Views)

Thanks for the fast replies guys!

 

I will change the property nodes to local variables; I thought it was the other way around for some reason!

 

As for the loops; the nested loops activate sequentially, since if I tried to ping all four addresses at the same time, it would return an error. Although I suppose a case structure would be a much cleaner way of implementing it.

 

In regards to the .NET object, I previously tried creating the object outside of the loop, but it would return with null. However, I haven't tried hooking it up to a shift register, so thanks for the tip!


Much appreciated,

Ryan

0 Kudos
Message 6 of 14
(3,030 Views)

@aptivo wrote:

Is it really necessary to write something new?

There are tons of ready to use programs available for that use case, like MSI Afterburner to name only one.


Maybe this person is like me; like to program things just because it's fun, or to keep the ol' LabVIEW skills sharp.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 7 of 14
(3,027 Views)

I got that point. If this would have been a time-critical task, I’d only like to show an easy workaround.

0 Kudos
Message 8 of 14
(3,016 Views)

@Ryan5 wrote:

As for the loops; the nested loops activate sequentially


Actually they don't. They all run at the same time.  The difference in behaviour compared to when the outer loop simply doesn't exist is most likely negligible.  There is no data dependency between them forcing them into sequential operation at all.

0 Kudos
Message 9 of 14
(3,003 Views)

Ah yes I've just done some testing and you're right! They only appear to be activating sequentially since it can only ping one target at a time. I'll re-arrange that part into a case structure.

 

Thanks for pointing that out!

 

 

0 Kudos
Message 10 of 14
(2,992 Views)