Class SystemUsage


  • public class SystemUsage
    extends java.lang.Object
    Utility class for obtaining System usage statistics.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static double getAverageSystemLoad()
      Check how active the system is (CPU) or if not available, using system load average.
      static long getFreeDiskSpace()
      Check how much disk space is available on the current partition.
      static long getUsedMemory()
      Check how much memory (in Mb) is in use.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getUsedMemory

        public static long getUsedMemory()
        Check how much memory (in Mb) is in use.
        Returns:
        used memory (megabytes) at the time of fetching
      • getAverageSystemLoad

        public static double getAverageSystemLoad()
        Check how active the system is (CPU) or if not available, using system load average.

        - On some OSes CPU usage information is not available, and system load average is used instead. - On some OSes system load average is not available.

        Returns:
        0.0 to 100.0 if CPU, or system load average, or -1 if nothing is available.
      • getFreeDiskSpace

        public static long getFreeDiskSpace()
        Check how much disk space is available on the current partition.
        Returns:
        free disk space (megabytes) on the partition JVM working directory is in.
        Throws:
        java.lang.SecurityException - if permission is required to see disk space.