jdk/src/jdk.management/share/classes/com/sun/management/OperatingSystemMXBean.java
author sjiang
Fri, 17 Apr 2015 09:40:02 +0200
changeset 30355 e37c7eba132f
parent 25859 jdk/src/java.management/share/classes/com/sun/management/OperatingSystemMXBean.java@3317bb8137f4
child 32210 958d823579c3
permissions -rw-r--r--
8042901: Allow com.sun.management to be in a different module to java.lang.management Reviewed-by: mchung, dfuchs, erikj, jbachorik
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
23010
6dadb192ad81 8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents: 20742
diff changeset
     2
 * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package com.sun.management;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 * Platform-specific management interface for the operating system
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * on which the Java virtual machine is running.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * The <tt>OperatingSystemMXBean</tt> object returned by
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * {@link java.lang.management.ManagementFactory#getOperatingSystemMXBean()}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * is an instance of the implementation class of this interface
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * or {@link UnixOperatingSystemMXBean} interface depending on
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * its underlying operating system.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * @author  Mandy Chung
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * @since   1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 */
20742
4ae78e8060d6 8008662: Add @jdk.Exported to JDK-specific/exported APIs
alanb
parents: 14342
diff changeset
    42
@jdk.Exported
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
public interface OperatingSystemMXBean extends
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
    java.lang.management.OperatingSystemMXBean {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
     * Returns the amount of virtual memory that is guaranteed to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
     * be available to the running process in bytes,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
     * or <tt>-1</tt> if this operation is not supported.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
     * @return the amount of virtual memory that is guaranteed to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
     * be available to the running process in bytes,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
     * or <tt>-1</tt> if this operation is not supported.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    public long getCommittedVirtualMemorySize();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     * Returns the total amount of swap space in bytes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     * @return the total amount of swap space in bytes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    public long getTotalSwapSpaceSize();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * Returns the amount of free swap space in bytes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * @return the amount of free swap space in bytes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    public long getFreeSwapSpaceSize();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * Returns the CPU time used by the process on which the Java
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * virtual machine is running in nanoseconds.  The returned value
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * is of nanoseconds precision but not necessarily nanoseconds
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * accuracy.  This method returns <tt>-1</tt> if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * the platform does not support this operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * @return the CPU time used by the process in nanoseconds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * or <tt>-1</tt> if this operation is not supported.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    public long getProcessCpuTime();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * Returns the amount of free physical memory in bytes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * @return the amount of free physical memory in bytes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    public long getFreePhysicalMemorySize();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * Returns the total amount of physical memory in bytes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * @return the total amount of physical memory in  bytes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    public long getTotalPhysicalMemorySize();
9559
24c0a7a7297f 7028071: Add two attributes to the OperatingSystemMXBean to provide CPU Load info
fparain
parents: 5506
diff changeset
    96
24c0a7a7297f 7028071: Add two attributes to the OperatingSystemMXBean to provide CPU Load info
fparain
parents: 5506
diff changeset
    97
    /**
24c0a7a7297f 7028071: Add two attributes to the OperatingSystemMXBean to provide CPU Load info
fparain
parents: 5506
diff changeset
    98
     * Returns the "recent cpu usage" for the whole system. This value is a
24c0a7a7297f 7028071: Add two attributes to the OperatingSystemMXBean to provide CPU Load info
fparain
parents: 5506
diff changeset
    99
     * double in the [0.0,1.0] interval. A value of 0.0 means that all CPUs
24c0a7a7297f 7028071: Add two attributes to the OperatingSystemMXBean to provide CPU Load info
fparain
parents: 5506
diff changeset
   100
     * were idle during the recent period of time observed, while a value
24c0a7a7297f 7028071: Add two attributes to the OperatingSystemMXBean to provide CPU Load info
fparain
parents: 5506
diff changeset
   101
     * of 1.0 means that all CPUs were actively running 100% of the time
24c0a7a7297f 7028071: Add two attributes to the OperatingSystemMXBean to provide CPU Load info
fparain
parents: 5506
diff changeset
   102
     * during the recent period being observed. All values betweens 0.0 and
24c0a7a7297f 7028071: Add two attributes to the OperatingSystemMXBean to provide CPU Load info
fparain
parents: 5506
diff changeset
   103
     * 1.0 are possible depending of the activities going on in the system.
24c0a7a7297f 7028071: Add two attributes to the OperatingSystemMXBean to provide CPU Load info
fparain
parents: 5506
diff changeset
   104
     * If the system recent cpu usage is not available, the method returns a
24c0a7a7297f 7028071: Add two attributes to the OperatingSystemMXBean to provide CPU Load info
fparain
parents: 5506
diff changeset
   105
     * negative value.
24c0a7a7297f 7028071: Add two attributes to the OperatingSystemMXBean to provide CPU Load info
fparain
parents: 5506
diff changeset
   106
     *
24c0a7a7297f 7028071: Add two attributes to the OperatingSystemMXBean to provide CPU Load info
fparain
parents: 5506
diff changeset
   107
     * @return the "recent cpu usage" for the whole system; a negative
24c0a7a7297f 7028071: Add two attributes to the OperatingSystemMXBean to provide CPU Load info
fparain
parents: 5506
diff changeset
   108
     * value if not available.
24c0a7a7297f 7028071: Add two attributes to the OperatingSystemMXBean to provide CPU Load info
fparain
parents: 5506
diff changeset
   109
     * @since   1.7
24c0a7a7297f 7028071: Add two attributes to the OperatingSystemMXBean to provide CPU Load info
fparain
parents: 5506
diff changeset
   110
     */
24c0a7a7297f 7028071: Add two attributes to the OperatingSystemMXBean to provide CPU Load info
fparain
parents: 5506
diff changeset
   111
    public double getSystemCpuLoad();
24c0a7a7297f 7028071: Add two attributes to the OperatingSystemMXBean to provide CPU Load info
fparain
parents: 5506
diff changeset
   112
24c0a7a7297f 7028071: Add two attributes to the OperatingSystemMXBean to provide CPU Load info
fparain
parents: 5506
diff changeset
   113
    /**
24c0a7a7297f 7028071: Add two attributes to the OperatingSystemMXBean to provide CPU Load info
fparain
parents: 5506
diff changeset
   114
     * Returns the "recent cpu usage" for the Java Virtual Machine process.
24c0a7a7297f 7028071: Add two attributes to the OperatingSystemMXBean to provide CPU Load info
fparain
parents: 5506
diff changeset
   115
     * This value is a double in the [0.0,1.0] interval. A value of 0.0 means
24c0a7a7297f 7028071: Add two attributes to the OperatingSystemMXBean to provide CPU Load info
fparain
parents: 5506
diff changeset
   116
     * that none of the CPUs were running threads from the JVM process during
24c0a7a7297f 7028071: Add two attributes to the OperatingSystemMXBean to provide CPU Load info
fparain
parents: 5506
diff changeset
   117
     * the recent period of time observed, while a value of 1.0 means that all
24c0a7a7297f 7028071: Add two attributes to the OperatingSystemMXBean to provide CPU Load info
fparain
parents: 5506
diff changeset
   118
     * CPUs were actively running threads from the JVM 100% of the time
24c0a7a7297f 7028071: Add two attributes to the OperatingSystemMXBean to provide CPU Load info
fparain
parents: 5506
diff changeset
   119
     * during the recent period being observed. Threads from the JVM include
24c0a7a7297f 7028071: Add two attributes to the OperatingSystemMXBean to provide CPU Load info
fparain
parents: 5506
diff changeset
   120
     * the application threads as well as the JVM internal threads. All values
24c0a7a7297f 7028071: Add two attributes to the OperatingSystemMXBean to provide CPU Load info
fparain
parents: 5506
diff changeset
   121
     * betweens 0.0 and 1.0 are possible depending of the activities going on
24c0a7a7297f 7028071: Add two attributes to the OperatingSystemMXBean to provide CPU Load info
fparain
parents: 5506
diff changeset
   122
     * in the JVM process and the whole system. If the Java Virtual Machine
24c0a7a7297f 7028071: Add two attributes to the OperatingSystemMXBean to provide CPU Load info
fparain
parents: 5506
diff changeset
   123
     * recent CPU usage is not available, the method returns a negative value.
24c0a7a7297f 7028071: Add two attributes to the OperatingSystemMXBean to provide CPU Load info
fparain
parents: 5506
diff changeset
   124
     *
24c0a7a7297f 7028071: Add two attributes to the OperatingSystemMXBean to provide CPU Load info
fparain
parents: 5506
diff changeset
   125
     * @return the "recent cpu usage" for the Java Virtual Machine process;
24c0a7a7297f 7028071: Add two attributes to the OperatingSystemMXBean to provide CPU Load info
fparain
parents: 5506
diff changeset
   126
     * a negative value if not available.
24c0a7a7297f 7028071: Add two attributes to the OperatingSystemMXBean to provide CPU Load info
fparain
parents: 5506
diff changeset
   127
     * @since   1.7
24c0a7a7297f 7028071: Add two attributes to the OperatingSystemMXBean to provide CPU Load info
fparain
parents: 5506
diff changeset
   128
     */
24c0a7a7297f 7028071: Add two attributes to the OperatingSystemMXBean to provide CPU Load info
fparain
parents: 5506
diff changeset
   129
    public double getProcessCpuLoad();
24c0a7a7297f 7028071: Add two attributes to the OperatingSystemMXBean to provide CPU Load info
fparain
parents: 5506
diff changeset
   130
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
}