Class SystemInfo

java.lang.Object
com.seeq.utilities.process.SystemInfo

public final class SystemInfo extends Object
Convenience functions related to the properties of the system.
  • Field Details

    • BYTES_PER_GIGABYTE

      public static final long BYTES_PER_GIGABYTE
      See Also:
    • BYTES_PER_GIBIBYTE

      public static final long BYTES_PER_GIBIBYTE
      See Also:
    • MINIMUM_USABLE_SPACE_IN_GIGABYTES

      public static final long MINIMUM_USABLE_SPACE_IN_GIGABYTES
      See Also:
    • MINIMUM_USABLE_SPACE_IN_BYTES

      public static final long MINIMUM_USABLE_SPACE_IN_BYTES
      See Also:
    • MINIMUM_CPU_CORES

      public static final long MINIMUM_CPU_CORES
      See Also:
    • MINIMUM_PAGE_SIZE

      public static final int MINIMUM_PAGE_SIZE
      See Also:
    • MINIMUM_MEMORY_IN_BYTES

      public static final long MINIMUM_MEMORY_IN_BYTES
      See Also:
  • Method Details

    • isDiskTooFull

      public static boolean isDiskTooFull(File disk)
      Decide if the disk has enough space to safely run Seeq. See CRAB-10248.
      Parameters:
      disk - A file on the disk in question. Likely the Seeq data directory.
      Returns:
      True if the disk is too full and Seeq should shut down; false if there is enough space.
    • getRecommendedPageSize

      public static int getRecommendedPageSize()
      This method calculates an optimal page size for database queries based on the memory available to appserver.
      Returns:
      the recommended page size for database queries.
    • getUsableDiskSpaceSafely

      public static long getUsableDiskSpaceSafely(File disk)
      Get the amount of usable disk space. Note that 'usable' disk space is typically lower than disk-reported 'free' disk space.
      Parameters:
      disk - A file on the disk in question. Likely the Seeq data directory.
      Returns:
      the amount of usable disk space in bytes. If the query failed, returns -1.
    • getTotalDiskSpaceSafely

      public static long getTotalDiskSpaceSafely(File disk)
      Get the amount of total disk space.
      Parameters:
      disk - A file on the disk in question. Likely the Seeq data directory.
      Returns:
      the amount of usable disk space in bytes. If the query failed, returns -1.
    • getSystemMemoryInfo

      public static String getSystemMemoryInfo(Runtime runtime)
      Retrieves a string representation of the memory statistics of the Java virtual machine. Primarily intended for logging.
      Returns:
      The memory statistics of the system. Primarily intended for logging.
    • getTotalPhysicalMemory

      public static long getTotalPhysicalMemory(OperatingSystemMXBean osMXBean)
      Retrieves the amount of actual system memory in bytes.
      Parameters:
      osMXBean - an instance of ManagementFactory.getOperatingSystemMXBean()
      Returns:
      The amount of actual system memory
    • humanReadableByteCount

      public static String humanReadableByteCount(long bytes, boolean useBaseTwo)
      Constructs a human readable string of the given bytes, such as '2.02GiB' or '9.75TB'.
      Parameters:
      bytes - The byte value for which to construct a human readable representation.
      useBaseTwo - If true, uses base-two units (GiB). If false, uses base-ten units (GB).
      Returns:
      A human readable string of the given bytes, such as '2.02GiB' or '9.75TB'.
    • humanReadableByteCount

      public static String humanReadableByteCount(long bytes, boolean useBaseTwo, boolean roundToInt)
      Constructs a human readable string of the given bytes, such as '2.02GiB' or '9TB'.
      Parameters:
      bytes - The byte value for which to construct a human readable representation.
      useBaseTwo - If true, uses base-two units (GiB). If false, uses base-ten units (GB).
      roundToInt - If true, rounds the value to the nearest integer. If false, outputs two decimal points.
      Returns:
      A human readable string of the given bytes, such as '2.02GiB' or '9TB'.