Using Java to retrieve the CPU Usage for Window's Processes

Posted by stjowa on Stack Overflow See other posts from Stack Overflow or by stjowa
Published on 2009-11-19T23:16:53Z Indexed on 2010/04/04 4:03 UTC
Read the original article Hit count: 424

Hello all,

I am looking for a Java solution to finding the CPU usage for a running process in Windows. After looking around the web, there seems to be little information on a solution in Java. Keep in mind, I am not looking to find the CPU usage for the JVM, but any process running in Windows at the time.

I am able to retrieve the memory usage in Java by using the exec("tasklist.exe ... ") to retrieve and parse process information. Although there is an aggregate CPU cycle timer for each process, I do not see a CPU usage column.

Any help would be greatly appreciated. Also, if possible, I would like to stay away from C libraries; however, if there is no other alternative, a solution by that means would be appropriate.

Thanks a lot,

Steve

© Stack Overflow or respective owner

Related posts about java

Related posts about Windows