Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/com/sun/management/OperatingSystemMXBean.java
38831 views
/*1* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package com.sun.management;2627/**28* Platform-specific management interface for the operating system29* on which the Java virtual machine is running.30*31* <p>32* This interface provides information about the operating environment33* on which the Java virtual machine is running. That might be a native34* operating system, a virtualized operating system environment, or a35* container-managed environment.36*37* <p>38* The <tt>OperatingSystemMXBean</tt> object returned by39* {@link java.lang.management.ManagementFactory#getOperatingSystemMXBean()}40* is an instance of the implementation class of this interface41* or {@link UnixOperatingSystemMXBean} interface depending on42* its underlying operating system.43*44* @author Mandy Chung45* @since 1.546*/47@jdk.Exported48public interface OperatingSystemMXBean extends49java.lang.management.OperatingSystemMXBean {5051/**52* Returns the amount of virtual memory that is guaranteed to53* be available to the running process in bytes,54* or <tt>-1</tt> if this operation is not supported.55*56* @return the amount of virtual memory that is guaranteed to57* be available to the running process in bytes,58* or <tt>-1</tt> if this operation is not supported.59*/60public long getCommittedVirtualMemorySize();6162/**63* Returns the total amount of swap space in bytes.64*65* @return the total amount of swap space in bytes.66*/67public long getTotalSwapSpaceSize();6869/**70* Returns the amount of free swap space in bytes.71*72* @return the amount of free swap space in bytes.73*/74public long getFreeSwapSpaceSize();7576/**77* Returns the CPU time used by the process on which the Java78* virtual machine is running in nanoseconds. The returned value79* is of nanoseconds precision but not necessarily nanoseconds80* accuracy. This method returns <tt>-1</tt> if the81* the platform does not support this operation.82*83* @return the CPU time used by the process in nanoseconds,84* or <tt>-1</tt> if this operation is not supported.85*/86public long getProcessCpuTime();8788/**89* Returns the amount of free physical memory in bytes.90*91* @return the amount of free physical memory in bytes.92*/93public long getFreePhysicalMemorySize();9495/**96* Returns the total amount of physical memory in bytes.97*98* @return the total amount of physical memory in bytes.99*/100public long getTotalPhysicalMemorySize();101102/**103* Returns the "recent cpu usage" for the whole system. This value is a104* double in the [0.0,1.0] interval. A value of 0.0 means that all CPUs105* were idle during the recent period of time observed, while a value106* of 1.0 means that all CPUs were actively running 100% of the time107* during the recent period being observed. All values betweens 0.0 and108* 1.0 are possible depending of the activities going on in the system.109* If the system recent cpu usage is not available, the method returns a110* negative value.111*112* @return the "recent cpu usage" for the whole system; a negative113* value if not available.114* @since 1.7115*/116public double getSystemCpuLoad();117118/**119* Returns the "recent cpu usage" for the Java Virtual Machine process.120* This value is a double in the [0.0,1.0] interval. A value of 0.0 means121* that none of the CPUs were running threads from the JVM process during122* the recent period of time observed, while a value of 1.0 means that all123* CPUs were actively running threads from the JVM 100% of the time124* during the recent period being observed. Threads from the JVM include125* the application threads as well as the JVM internal threads. All values126* betweens 0.0 and 1.0 are possible depending of the activities going on127* in the JVM process and the whole system. If the Java Virtual Machine128* recent CPU usage is not available, the method returns a negative value.129*130* @return the "recent cpu usage" for the Java Virtual Machine process;131* a negative value if not available.132* @since 1.7133*/134public double getProcessCpuLoad();135136}137138139