org.apache.hadoop.yarn.api.records

## Class ResourceUtilization

- java.lang.Object
- - org.apache.hadoop.yarn.api.records.ResourceUtilization

- All Implemented Interfaces:
    Comparable<ResourceUtilization>

      @InterfaceAudience.Public
       @InterfaceStability.Unstable
      public abstract class ResourceUtilization
      extends Object
      implements Comparable<ResourceUtilization>

  `ResourceUtilization` models the utilization of a set of computer resources in the cluster.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ResourceUtilization()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addTo(int pmem, int vmem, float cpu)` Add utilization to the current one.
    `boolean` | `equals(Object obj)`
    `abstract float` | `getCPU()` Get CPU utilization.
    `abstract int` | `getPhysicalMemory()` Get physical memory.
    `abstract int` | `getVirtualMemory()` Get used virtual memory.
    `int` | `hashCode()`
    `static ResourceUtilization` | `newInstance(int pmem, int vmem, float cpu)`
    `static ResourceUtilization` | `newInstance(ResourceUtilization resourceUtil)`
    `abstract void` | `setCPU(float cpu)` Set CPU utilization.
    `abstract void` | `setPhysicalMemory(int pmem)` Set physical memory.
    `abstract void` | `setVirtualMemory(int vmem)` Set used virtual memory.
    `void` | `subtractFrom(int pmem, int vmem, float cpu)` Subtract utilization from the current one.
    `String` | `toString()`

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface java.lang.Comparable

      `compareTo`

- - ### Constructor Detail

    - #### ResourceUtilization

          public ResourceUtilization()

  - ### Method Detail

    - #### newInstance

          @InterfaceAudience.Public
           @InterfaceStability.Unstable
          public static ResourceUtilization newInstance(int pmem,
                                                                                                                int vmem,
                                                                                                                float cpu)

    - #### newInstance

          @InterfaceAudience.Public
           @InterfaceStability.Unstable
          public static ResourceUtilization newInstance(ResourceUtilization resourceUtil)

    - #### getVirtualMemory

          @InterfaceAudience.Public
           @InterfaceStability.Unstable
          public abstract int getVirtualMemory()

      Get used virtual memory.
      Returns:
        virtual memory in MB

    - #### setVirtualMemory

          @InterfaceAudience.Public
           @InterfaceStability.Unstable
          public abstract void setVirtualMemory(int vmem)

      Set used virtual memory.
      Parameters:
        `vmem` - virtual memory in MB

    - #### getPhysicalMemory

          @InterfaceAudience.Public
           @InterfaceStability.Unstable
          public abstract int getPhysicalMemory()

      Get physical memory.
      Returns:
        physical memory in MB

    - #### setPhysicalMemory

          @InterfaceAudience.Public
           @InterfaceStability.Unstable
          public abstract void setPhysicalMemory(int pmem)

      Set physical memory.
      Parameters:
        `pmem` - physical memory in MB

    - #### getCPU

          @InterfaceAudience.Public
           @InterfaceStability.Unstable
          public abstract float getCPU()

      Get CPU utilization.
      Returns:
        CPU utilization normalized to 1 CPU

    - #### setCPU

          @InterfaceAudience.Public
           @InterfaceStability.Unstable
          public abstract void setCPU(float cpu)

      Set CPU utilization.
      Parameters:
        `cpu` - CPU utilization normalized to 1 CPU

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### addTo

          @InterfaceAudience.Public
           @InterfaceStability.Unstable
          public void addTo(int pmem,
                                                                                    int vmem,
                                                                                    float cpu)

      Add utilization to the current one.
      Parameters:
        `pmem` - Physical memory used to add.
        `vmem` - Virtual memory used to add.
        `cpu` - CPU utilization to add.

    - #### subtractFrom

          @InterfaceAudience.Public
           @InterfaceStability.Unstable
          public void subtractFrom(int pmem,
                                                                                           int vmem,
                                                                                           float cpu)

      Subtract utilization from the current one.
      Parameters:
        `pmem` - Physical memory to be subtracted.
        `vmem` - Virtual memory to be subtracted.
        `cpu` - CPU utilization to be subtracted.

Copyright © 2022 Apache Software Foundation. All rights reserved.