Module openj9.jvm
Package com.ibm.jvm

Class Stats

java.lang.Object
com.ibm.jvm.Stats

public class Stats extends Object
This class is used provide the following java heap and system statistics:
  • committed heap memory
  • used heap memory
  • max heap memory
  • softmx heap memory
  • free physical memory
  • total physical memory
All this info is retrieved without any allocation of new objects.
  • Constructor Details

    • Stats

      public Stats()
      Construct a new instance.
  • Method Details

    • setFields

      public void setFields(long committed, long used, long max, long free, long tot, double sysLoadAvg, long cpuTime, long softmxHeap)
      To avoid allocating new objects, this function merely sets the member variables of this class as it is called from a native.
      Parameters:
      committed - is the committed heap size (bytes)
      used - is the amount of used memory on the java heap (bytes)
      max - is the maximum bound of the java heap (bytes)
      free - is the amount of free physical memory (bytes)
      tot - is the amount of total physical memory (bytes)
      sysLoadAvg - is the system load average in decimal (capacity of cpu)
      cpuTime - is the time elapsed since the start of the jvm process
      softmxHeap - is the softmx heap value (-Xsoftmx or changed from MemoryMXBean) value in bytes
    • getCommittedHeap

      public long getCommittedHeap()
      Returns:
      the committed heap (reserved memory) in bytes
    • getUsedHeap

      public long getUsedHeap()
      Returns:
      how much of the java heap is used by the application in bytes
    • getMaxHeap

      public long getMaxHeap()
      Returns:
      the maximum java heap memory that can be used by the jvm application (-Xmx) in bytes
    • getSoftmxHeap

      public long getSoftmxHeap()
      Returns:
      the softmx java heap memory (set by -Xsoftmx or from the MemoryMXBean.setMaxHeapSize)
    • getFreePhysicalMem

      public long getFreePhysicalMem()
      Returns:
      the amount of free physical memory in bytes
    • getTotPhysicalMem

      public long getTotPhysicalMem()
      Returns:
      the total amount of physical memory in bytes
    • getSysLoadAvg

      public double getSysLoadAvg()
      Returns:
      the system load average in last minute (fraction)
    • getCpuTime

      public long getCpuTime()
      Returns total amount of time the process has been scheduled or executed so far in both kernel and user modes.
      Returns:
      time in 100 ns units, or -1 in the case of an error or if this metric is not supported for this operating system.
    • getStats

      public void getStats()
      Native method used to retrieve the heap/OS stats.