本文介绍了JDK7 +中的OperatingSystemMXBean getProcessCpuTime()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我看到jdk6的代码具有以下OperatingSystemMXBean方法:
OperatingSystemMXBean osbean =
(OperatingSystemMXBean)ManagementFactory .getOperatingSystemMXBean();
long prevProcessCpuTime = osbean.getProcessCpuTime();
在JDK7文档中似乎没有提及它们。
在jdk7 +的其他地方是否有jdk6方法的等价物?
解决方案
您在API文档中查找错误的位置,它位于7
I see code for jdk6 that has the following OperatingSystemMXBean method :
OperatingSystemMXBean osbean =
(OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
long prevProcessCpuTime = osbean.getProcessCpuTime();
In the JDK7 docs there appears not to be any mention of them. http://docs.oracle.com/javase/7/docs/api/java/lang/management/OperatingSystemMXBean.html
Are there any equivalents to the jdk6 method elsewhere in the jdk7+ ?
解决方案
You are looking at wrong place in API doc, It is there in 7
这篇关于JDK7 +中的OperatingSystemMXBean getProcessCpuTime()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!