Class MemoryUsage

java.lang.Object
com.ibm.lang.management.MemoryUsage

public class MemoryUsage extends Object
This represents a snapshot of the Operating System level Memory usage statistics. This is available on AIX, Linux, Windows and z/OS.
Since:
1.7.1
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new MemoryUsage instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    Receives a CompositeData representing a MemoryUsage
    long
    The amount of buffered memory in bytes.
    long
    The amount of cached memory in bytes.
    long
    The total amount of free physical memory in bytes.
    long
    The amount of free swap space in bytes.
    long
    The amount of total swap space in bytes.
    long
    The timestamp when the usage statistics were last sampled in microseconds.
    long
    The total amount of usable physical memory in bytes.
    Text description of this MemoryUsage object.

    Methods declared in class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    Modifier and Type
    Method
    Description
    protected Object
    Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.
    boolean
    Compares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
    May cause performance issues, deadlocks and hangs.
    final Class<? extends Object>
    Answers the unique instance of java.lang.Class which represents the class of the receiver.
    int
    Answers an integer hash code for the receiver.
    final void
    Causes one thread which is waiting on the receiver to be made ready to run.
    final void
    Causes all threads which are waiting on the receiver to be made ready to run.
    final void
    Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated by notify or notifyAll).
    final void
    wait(long time)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.
    final void
    wait(long time, int frac)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.
  • Constructor Details

    • MemoryUsage

      public MemoryUsage()
      Creates a new MemoryUsage instance.
  • Method Details

    • getTotal

      public long getTotal()
      The total amount of usable physical memory in bytes.
      Returns:
      Total physical memory in bytes or -1 if info not available.
    • getFree

      public long getFree()
      The total amount of free physical memory in bytes.
      Returns:
      Free physical memory in bytes or -1 if info not available.
    • getSwapTotal

      public long getSwapTotal()
      The amount of total swap space in bytes.
      Returns:
      Total swap space in bytes or -1 if info not available.
    • getSwapFree

      public long getSwapFree()
      The amount of free swap space in bytes.
      Returns:
      Free swap space in bytes or -1 if info not available.
    • getCached

      public long getCached()
      The amount of cached memory in bytes. Cached memory usually consists of contents of files and block devices.
      Returns:
      Cached memory in bytes or -1 if info not available.
    • getBuffered

      public long getBuffered()
      The amount of buffered memory in bytes. Buffered memory usually consists of file metadata.
      • Buffered memory is not available on AIX and Windows.
      Returns:
      Buffered memory in bytes or -1 if info not available.
    • getTimestamp

      public long getTimestamp()
      The timestamp when the usage statistics were last sampled in microseconds.
      Returns:
      Timestamp in microseconds.
    • from

      public static MemoryUsage from(CompositeData cd)
      Receives a CompositeData representing a MemoryUsage
      Parameters:
      cd - A CompositeData that represents a MemoryUsage
      Returns:
      If cd is non- null, returns a new instance of MemoryUsage, If cd is null, returns null.
      Throws:
      IllegalArgumentException - if argument cd does not correspond to a MemoryUsage with the following attributes:
      • total(java.lang.Long)
      • free(java.lang.Long)
      • swapTotal(java.lang.Long)
      • swapFree(java.lang.Long)
      • cached(java.lang.Long)
      • buffered(java.lang.Long)
      • timestamp(java.lang.Long)
    • toString

      public String toString()
      Text description of this MemoryUsage object.
      Overrides:
      toString in class Object
      Returns:
      a text description of this MemoryUsage object.