LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Monitor CPU usage for every process

Short version:  I'm looking for a way to monitor the CPU being used by every running process and log that information (basically Task Manager).  Anyone have any ideas that aren't overly complex?

 

Long version: Unfortunately, after some research and playing I haven't found a Windows API call to give me this information. I've played with calls to the System.Diagnostics.Process class and can get the total time, etc.  I've also played with EnumProcesses and even the DOS Tasklist command.  I have no problem getting CPU time, but as a % of CPU used there doesn't seem to be a method.

 

My next approach will be monitoring the CPU times, comparing to other processes, etc etc. but that seems pretty convoluted... so, I figured I'd ask here before digging more.  I've seen a few people here who seem to know the Windows API pretty well.

0 Kudos
Message 1 of 4
(4,567 Views)

Take a look at this recent thread:

Debugging exotic LabVIEW problems - Performance Monitor

and also the community example:

Task manager in Labview

Message 2 of 4
(4,557 Views)

@RavensFan wrote:

Take a look at this recent thread:

Debugging exotic LabVIEW problems - Performance Monitor

and also the community example:

Task manager in Labview


 

Thanks for the response.  Neither of these quite do what I need though...

 

Performance Monitor:  I forgot to mention in above post - I played with that.  The issue I found was I had to add counters for specific threads.  If a new process started that I didn't know about it would not be added to the logging.  It is my 2nd option if I can't figure this out.

 

Task manager in LabVIEW: Doesn't show processor % used per task.  I didn't look into his DLLs but there are Windows API .NET calls (linked above) that give more detailed information than the example project.

 

Edit:  Woah... nevermind.  The task manager app does monitor by process if you click on it.  I'll have to look into the DLLs he is using.  Thanks!

0 Kudos
Message 3 of 4
(4,551 Views)

Little late coming in, but here is the VI I use which monitors CPU usage per process, but it does this in a way that may take a decent amount of time depending on the number of processes you are checking.

 

http://forums.ni.com/t5/LabVIEW/Checking-to-see-if-a-process-is-running/m-p/2834814#M828361

 

 

0 Kudos
Message 4 of 4
(4,538 Views)