0N/A/*
2362N/A * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/Apackage sun.management.snmp.jvminstr;
0N/A
0N/A// java imports
0N/A//
0N/Aimport java.io.Serializable;
0N/Aimport java.lang.management.ManagementFactory;
0N/Aimport java.lang.management.CompilationMXBean;
0N/A
0N/A// jmx imports
0N/A//
0N/Aimport javax.management.MBeanServer;
0N/Aimport com.sun.jmx.snmp.SnmpString;
0N/Aimport com.sun.jmx.snmp.SnmpStatusException;
0N/A
0N/A// jdmk imports
0N/A//
0N/Aimport com.sun.jmx.snmp.agent.SnmpMib;
0N/A
0N/Aimport sun.management.snmp.jvmmib.JvmCompilationMBean;
0N/Aimport sun.management.snmp.jvmmib.EnumJvmJITCompilerTimeMonitoring;
0N/Aimport sun.management.snmp.util.MibLogger;
0N/A
0N/A/**
0N/A * The class is used for implementing the "JvmCompilation" group.
0N/A */
0N/Apublic class JvmCompilationImpl implements JvmCompilationMBean {
0N/A
0N/A /**
0N/A * Variable for storing the value of "JvmJITCompilerTimeMonitoring".
0N/A *
0N/A * "Indicates whether the Java virtual machine supports
0N/A * compilation time monitoring.
0N/A *
0N/A * See java.management.CompilationMXBean.
0N/A * isCompilationTimeMonitoringSupported()
0N/A * "
0N/A *
0N/A */
0N/A static final EnumJvmJITCompilerTimeMonitoring
0N/A JvmJITCompilerTimeMonitoringSupported =
0N/A new EnumJvmJITCompilerTimeMonitoring("supported");
0N/A static final EnumJvmJITCompilerTimeMonitoring
0N/A JvmJITCompilerTimeMonitoringUnsupported =
0N/A new EnumJvmJITCompilerTimeMonitoring("unsupported");
0N/A
0N/A
0N/A /**
0N/A * Constructor for the "JvmCompilation" group.
0N/A * If the group contains a table, the entries created through an SNMP SET
0N/A * will not be registered in Java DMK.
0N/A */
0N/A public JvmCompilationImpl(SnmpMib myMib) {
0N/A }
0N/A
0N/A
0N/A /**
0N/A * Constructor for the "JvmCompilation" group.
0N/A * If the group contains a table, the entries created through an SNMP
0N/A * SET will be AUTOMATICALLY REGISTERED in Java DMK.
0N/A */
0N/A public JvmCompilationImpl(SnmpMib myMib, MBeanServer server) {
0N/A }
0N/A
0N/A private static CompilationMXBean getCompilationMXBean() {
0N/A return ManagementFactory.getCompilationMXBean();
0N/A }
0N/A
0N/A /**
0N/A * Getter for the "JvmJITCompilerTimeMonitoring" variable.
0N/A */
0N/A public EnumJvmJITCompilerTimeMonitoring getJvmJITCompilerTimeMonitoring()
0N/A throws SnmpStatusException {
0N/A
0N/A // If we reach this point, then we can safely assume that
0N/A // getCompilationMXBean() will not return null, because this
0N/A // object will not be instantiated when there is no compilation
0N/A // system (see JVM_MANAGEMENT_MIB_IMPL).
0N/A //
0N/A if(getCompilationMXBean().isCompilationTimeMonitoringSupported())
0N/A return JvmJITCompilerTimeMonitoringSupported;
0N/A else
0N/A return JvmJITCompilerTimeMonitoringUnsupported;
0N/A }
0N/A
0N/A /**
0N/A * Getter for the "JvmJITCompilerTimeMs" variable.
0N/A */
0N/A public Long getJvmJITCompilerTimeMs() throws SnmpStatusException {
0N/A final long t;
0N/A if(getCompilationMXBean().isCompilationTimeMonitoringSupported())
0N/A t = getCompilationMXBean().getTotalCompilationTime();
0N/A else
0N/A t = 0;
0N/A return new Long(t);
0N/A }
0N/A
0N/A /**
0N/A * Getter for the "JvmJITCompilerName" variable.
0N/A */
0N/A public String getJvmJITCompilerName() throws SnmpStatusException {
0N/A return JVM_MANAGEMENT_MIB_IMPL.
0N/A validJavaObjectNameTC(getCompilationMXBean().getName());
0N/A }
0N/A
0N/A}