JDK7 +中的OperatingSystemMXBean getProcessCpuTime()

时间:2015-09-16 23:40:50

标签: java

我看到jdk6的代码具有以下OperatingSystemMXBean方法:

OperatingSystemMXBean osbean = 
    (OperatingSystemMXBean)      ManagementFactory.getOperatingSystemMXBean();

long prevProcessCpuTime = osbean.getProcessCpuTime();

在JDK7文档中似乎没有提及它们。 http://docs.oracle.com/javase/7/docs/api/java/lang/management/OperatingSystemMXBean.html

enter image description here

jdk7 +中其他地方的jdk6方法是否有任何等价物?

2 个答案:

答案 0 :(得分:1)

答案 1 :(得分:1)

需要投射结果:

val obs = java.lang.management.ManagementFactory
           .getOperatingSystemMXBean.asInstanceOf
          [com.sun.management.OperatingSystemMXBeanOperatingSystemMXBean]