1 /*
   2  * Copyright (c) 2003, 2011, 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 com.sun.management;
  27 
  28 /**
  29  * Platform-specific management interface for the operating system
  30  * on which the Java virtual machine is running.
  31  *
  32  * <p>
  33  * The <tt>OperatingSystemMXBean</tt> object returned by
  34  * {@link java.lang.management.ManagementFactory#getOperatingSystemMXBean()}
  35  * is an instance of the implementation class of this interface
  36  * or {@link UnixOperatingSystemMXBean} interface depending on
  37  * its underlying operating system.
  38  *
  39  * @author  Mandy Chung
  40  * @since   1.5
  41  */
  42 public interface OperatingSystemMXBean extends
  43     java.lang.management.OperatingSystemMXBean {
  44 
  45     /**
  46      * Returns the amount of virtual memory that is guaranteed to
  47      * be available to the running process in bytes,
  48      * or <tt>-1</tt> if this operation is not supported.
  49      *
  50      * @return the amount of virtual memory that is guaranteed to
  51      * be available to the running process in bytes,
  52      * or <tt>-1</tt> if this operation is not supported.
  53      */
  54     public long getCommittedVirtualMemorySize();
  55 
  56     /**
  57      * Returns the total amount of swap space in bytes.
  58      *
  59      * @return the total amount of swap space in bytes.
  60      */
  61     public long getTotalSwapSpaceSize();
  62 
  63     /**
  64      * Returns the amount of free swap space in bytes.
  65      *
  66      * @return the amount of free swap space in bytes.
  67      */
  68     public long getFreeSwapSpaceSize();
  69 
  70     /**
  71      * Returns the CPU time used by the process on which the Java
  72      * virtual machine is running in nanoseconds.  The returned value
  73      * is of nanoseconds precision but not necessarily nanoseconds
  74      * accuracy.  This method returns <tt>-1</tt> if the
  75      * the platform does not support this operation.
  76      *
  77      * @return the CPU time used by the process in nanoseconds,
  78      * or <tt>-1</tt> if this operation is not supported.
  79      */
  80     public long getProcessCpuTime();
  81 
  82     /**
  83      * Returns the amount of free physical memory in bytes.
  84      *
  85      * @return the amount of free physical memory in bytes.
  86      */
  87     public long getFreePhysicalMemorySize();
  88 
  89     /**
  90      * Returns the total amount of physical memory in bytes.
  91      *
  92      * @return the total amount of physical memory in  bytes.
  93      */
  94     public long getTotalPhysicalMemorySize();
  95 
  96     /**
  97      * Returns the "recent cpu usage" for the whole system. This value is a
  98      * double in the [0.0,1.0] interval. A value of 0.0 means that all CPUs
  99      * were idle during the recent period of time observed, while a value
 100      * of 1.0 means that all CPUs were actively running 100% of the time
 101      * during the recent period being observed. All values betweens 0.0 and
 102      * 1.0 are possible depending of the activities going on in the system.
 103      * If the system recent cpu usage is not available, the method returns a
 104      * negative value.
 105      *
 106      * @return the "recent cpu usage" for the whole system; a negative
 107      * value if not available.
 108      * @since   1.7
 109      */
 110     public double getSystemCpuLoad();
 111 
 112     /**
 113      * Returns the "recent cpu usage" for the Java Virtual Machine process.
 114      * This value is a double in the [0.0,1.0] interval. A value of 0.0 means
 115      * that none of the CPUs were running threads from the JVM process during
 116      * the recent period of time observed, while a value of 1.0 means that all
 117      * CPUs were actively running threads from the JVM 100% of the time
 118      * during the recent period being observed. Threads from the JVM include
 119      * the application threads as well as the JVM internal threads. All values
 120      * betweens 0.0 and 1.0 are possible depending of the activities going on
 121      * in the JVM process and the whole system. If the Java Virtual Machine
 122      * recent CPU usage is not available, the method returns a negative value.
 123      *
 124      * @return the "recent cpu usage" for the Java Virtual Machine process;
 125      * a negative value if not available.
 126      * @since   1.7
 127      */
 128     public double getProcessCpuLoad();
 129 
 130 }