Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
1 reply Latest Post - ‏2013-01-21T10:04:30Z by SystemAdmin
SystemAdmin
SystemAdmin
2736 Posts
ACCEPTED ANSWER

Pinned topic IBM JDK 6 OperatingSystemMXBean

‏2013-01-08T20:36:39Z |
Hello, I have been trying to use method getProcessCpu() from the OperatingSystemMXBean. I realized that method only exists on the sun private implementation of that class. However, while looking at IBM documentation, I noticed that the documentation references that method, even though it shouldn't exist on the IBM JVM or JDK. Is this a mistake, or am I missing something here?

http://publib.boulder.ibm.com/infocenter/javasdk/v6r0/index.jsp?topic=%2Fcom.ibm.java.doc.user.aix32.60%2Fuser%2Fuserguide.html

Java Diagnostics Guide 6 > Using diagnostic tools > Using JConsole
Updated on 2013-01-21T10:04:30Z at 2013-01-21T10:04:30Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    2736 Posts
    ACCEPTED ANSWER

    Re: IBM JDK 6 OperatingSystemMXBean

    ‏2013-01-21T10:04:30Z  in response to SystemAdmin
    I tested the method getProcessCPUTime() using JRE 1.6.0 IBM J9 2.4 Linux x86-32 jvmxi3260sr10fp1-20120202_101568 & it returns with value.
    java -showversion MXBeanTest
    java version "1.6.0"
    Java(TM) SE Runtime Environment (build pxi3260sr10fp1-20120321_01(SR10 FP1))
    IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 Linux x86-32 jvmxi3260sr10fp1-20120202_101568 (JIT enabled, AOT enabled)
    J9VM - 20120202_101568
    JIT - r9_20111107_21307ifx1
    GC - 20120202_AA)
    JCL - 20120320_01

    Linux
    CPUTime:3640220

    import com.ibm.lang.management.*;
    import java.lang.management.ManagementFactory;

    class MXBeanTest
    {
    public static void main(String args[])
    {
    OperatingSystemMXBean mxbean=(com.ibm.lang.management.OperatingSystemMXBean)ManagementFactory.getOperatingSystemMXBean();
    System.out.println(mxbean.getName());
    System.out.println("CPUTime:" + mxbean.getProcessCpuTime());
    }
    }