What is the right command line to get cpu usage fo

2019-07-13 12:07发布

问题:

Given a process ID, what is the right command to get the current cpu usage from the process, in Java.

The command typeperf "\Memory\Available bytes" "\processor(_total)\% processor time" is not for a specific process, and any 3rd party utility is not a option, ProcDump alike. Thanks for any pointers!

回答1:

Try http://support.hyperic.com/display/SIGAR/Home

Otherwise look at How can a Java program get its own process ID?