Get OS-level system information

后端 未结 16 2120
情话喂你
情话喂你 2020-11-22 02:02

I\'m currently building a Java app that could end up being run on many different platforms, but primarily variants of Solaris, Linux and Windows.

Has anyone been abl

16条回答
  •  天命终不由人
    2020-11-22 02:22

    Have a look at the APIs available in the java.lang.management package. For example:

    • OperatingSystemMXBean.getSystemLoadAverage()
    • ThreadMXBean.getCurrentThreadCpuTime()
    • ThreadMXBean.getCurrentThreadUserTime()

    There are loads of other useful things in there as well.

提交回复
热议问题