SysInfo (Apache Hadoop Common 3.5.0 API)
Description: declaration: package: org.apache.hadoop.util, class: SysInfo

Package org.apache.hadoop.util

# Class SysInfo

java.lang.Object
org.apache.hadoop.util.SysInfo

Direct Known Subclasses:
  `SysInfoLinux`, `SysInfoWindows`

@Public @Evolving public abstract class SysInfo extends Object
Plugin to calculate resource information on the system.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SysInfo()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `abstract long`
  `getAvailablePhysicalMemorySize()`
  Obtain the total size of the available physical memory present in the system.
  `abstract long`
  `getAvailableVirtualMemorySize()`
  Obtain the total size of the available virtual memory present in the system.
  `abstract long`
  `getCpuFrequency()`
  Obtain the CPU frequency of on the system.
  `abstract float`
  `getCpuUsagePercentage()`
  Obtain the CPU usage % of the machine.
  `abstract long`
  `getCumulativeCpuTime()`
  Obtain the cumulative CPU time since the system is on.
  `abstract long`
  `getNetworkBytesRead()`
  Obtain the aggregated number of bytes read over the network.
  `abstract long`
  `getNetworkBytesWritten()`
  Obtain the aggregated number of bytes written to the network.
  `abstract int`
  `getNumCores()`
  Obtain total number of physical cores present on the system.
  `abstract int`
  `getNumProcessors()`
  Obtain the total number of logical processors present on the system.
  `abstract float`
  `getNumVCoresUsed()`
  Obtain the number of VCores used.
  `abstract long`
  `getPhysicalMemorySize()`
  Obtain the total size of the physical memory present in the system.
  `abstract long`
  `getStorageBytesRead()`
  Obtain the aggregated number of bytes read from disks.
  `abstract long`
  `getStorageBytesWritten()`
  Obtain the aggregated number of bytes written to disks.
  `abstract long`
  `getVirtualMemorySize()`
  Obtain the total size of the virtual memory present in the system.
  `static SysInfo`
  `newInstance()`
  Return default OS instance.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### SysInfo

    public SysInfo()

- ## Method Details

  - ### newInstance

    public static SysInfo newInstance()
    Return default OS instance.
    Returns:
      Default instance for the detected OS.
    Throws:
      `UnsupportedOperationException` - If cannot determine OS.

  - ### getVirtualMemorySize

    public abstract long getVirtualMemorySize()
    Obtain the total size of the virtual memory present in the system.
    Returns:
      virtual memory size in bytes.

  - ### getPhysicalMemorySize

    public abstract long getPhysicalMemorySize()
    Obtain the total size of the physical memory present in the system.
    Returns:
      physical memory size bytes.

  - ### getAvailableVirtualMemorySize

    public abstract long getAvailableVirtualMemorySize()
    Obtain the total size of the available virtual memory present in the system.
    Returns:
      available virtual memory size in bytes.

  - ### getAvailablePhysicalMemorySize

    public abstract long getAvailablePhysicalMemorySize()
    Obtain the total size of the available physical memory present in the system.
    Returns:
      available physical memory size bytes.

  - ### getNumProcessors

    public abstract int getNumProcessors()
    Obtain the total number of logical processors present on the system.
    Returns:
      number of logical processors

  - ### getNumCores

    public abstract int getNumCores()
    Obtain total number of physical cores present on the system.
    Returns:
      number of physical cores

  - ### getCpuFrequency

    public abstract long getCpuFrequency()
    Obtain the CPU frequency of on the system.
    Returns:
      CPU frequency in kHz

  - ### getCumulativeCpuTime

    public abstract long getCumulativeCpuTime()
    Obtain the cumulative CPU time since the system is on.
    Returns:
      cumulative CPU time in milliseconds

  - ### getCpuUsagePercentage

    public abstract float getCpuUsagePercentage()
    Obtain the CPU usage % of the machine. Return -1 if it is unavailable
    Returns:
      CPU usage as a percentage (from 0 to 100) of available cycles.

  - ### getNumVCoresUsed

    public abstract float getNumVCoresUsed()
    Obtain the number of VCores used. Return -1 if it is unavailable
    Returns:
      Number of VCores used a percentage (from 0 to #VCores).

  - ### getNetworkBytesRead

    public abstract long getNetworkBytesRead()
    Obtain the aggregated number of bytes read over the network.
    Returns:
      total number of bytes read.

  - ### getNetworkBytesWritten

    public abstract long getNetworkBytesWritten()
    Obtain the aggregated number of bytes written to the network.
    Returns:
      total number of bytes written.

  - ### getStorageBytesRead

    public abstract long getStorageBytesRead()
    Obtain the aggregated number of bytes read from disks.
    Returns:
      total number of bytes read.

  - ### getStorageBytesWritten

    public abstract long getStorageBytesWritten()
    Obtain the aggregated number of bytes written to disks.
    Returns:
      total number of bytes written.