How can I get memory and CPU usage of an external

2019-09-17 19:32发布

I need to get info for memory and CPU usage of some process running on the machine (not the Java process).

How can I do that?

2条回答
在下西门庆
2楼-- · 2019-09-17 20:07

If I'm not mistaken Runtime.getRuntime is for the virtual machine and not the physical. What you are about asking is getting the physical machine information (meaning the CPU).

查看更多
Animai°情兽
3楼-- · 2019-09-17 20:17

It's platform dependent, but essentially use Runtime.getRuntime() to execute the appropriate command, capture its output and parse it for the data you need.

查看更多
登录 后发表回答