This content has been marked as final. Show 4 replies
One possibility is to use ProcessBuilder to execute
"tasklist /FO CSV"
and then parse the 'stdout'. You might find the CPU time resolution too small for you but ...
Note - you should read the 4 sections of http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html and implement ALL the recommendations. Though the article is written round Runtime.exec() the traps apply to the Process object however it is created.
you might want to check out the SIGAR library, http://support.hyperic.com/display/SIGAR/Home . we were looking for functionality like this and came across this library. in the testing i did, it seemed to work great, although we never ended up implementing the features which required it, so i never actually used it for real.