1 /*
   2  * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package java.lang.management;
  27 
  28 /**
  29  * The management interface for the compilation system of
  30  * the Java virtual machine.
  31  *
  32  * <p> A Java virtual machine has a single instance of the implementation
  33  * class of this interface.  This instance implementing this interface is
  34  * an <a href="ManagementFactory.html#MXBean">MXBean</a>
  35  * that can be obtained by calling
  36  * the {@link ManagementFactory#getCompilationMXBean} method or
  37  * from the {@link ManagementFactory#getPlatformMBeanServer
  38  * platform MBeanServer} method.
  39  *
  40  * <p>The {@code ObjectName} for uniquely identifying the MXBean for
  41  * the compilation system within an MBeanServer is:
  42  * <blockquote>
  43  *  {@link ManagementFactory#COMPILATION_MXBEAN_NAME
  44  *         java.lang:type=Compilation}
  45  * </blockquote>
  46  *
  47  * It can be obtained by calling the
  48  * {@link PlatformManagedObject#getObjectName} method.
  49  *
  50  * @see ManagementFactory#getPlatformMXBeans(Class)
  51  * @see <a href="../../../javax/management/package-summary.html">
  52  *      JMX Specification.</a>
  53  * @see <a href="package-summary.html#examples">
  54  *      Ways to Access MXBeans</a>
  55  *
  56  * @author  Mandy Chung
  57  * @since   1.5
  58  */
  59 public interface CompilationMXBean extends PlatformManagedObject {
  60     /**
  61      * Returns the name of the Just-in-time (JIT) compiler.
  62      *
  63      * @return the name of the JIT compiler.
  64      */
  65     public java.lang.String    getName();
  66 
  67     /**
  68      * Tests if the Java virtual machine supports the monitoring of
  69      * compilation time.
  70      *
  71      * @return {@code true} if the monitoring of compilation time is
  72      * supported; {@code false} otherwise.
  73      */
  74     public boolean isCompilationTimeMonitoringSupported();
  75 
  76     /**
  77      * Returns the approximate accumulated elapsed time (in milliseconds)
  78      * spent in compilation.
  79      * If multiple threads are used for compilation, this value is
  80      * summation of the approximate time that each thread spent in compilation.
  81      *
  82      * <p>This method is optionally supported by the platform.
  83      * A Java virtual machine implementation may not support the compilation
  84      * time monitoring. The {@link #isCompilationTimeMonitoringSupported}
  85      * method can be used to determine if the Java virtual machine
  86      * supports this operation.
  87      *
  88      * <p> This value does not indicate the level of performance of
  89      * the Java virtual machine and is not intended for performance comparisons
  90      * of different virtual machine implementations.
  91      * The implementations may have different definitions and different
  92      * measurements of the compilation time.
  93      *
  94      * @return Compilation time in milliseconds
  95      * @throws java.lang.UnsupportedOperationException if the Java
  96      * virtual machine does not support
  97      * this operation.
  98      *
  99      */
 100     public long                getTotalCompilationTime();
 101 }