hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asur...@apache.org
Subject hadoop git commit: YARN-4895. Add subtractFrom method to ResourceUtilization class. Contributed by Konstantinos Karanasos.
Date Fri, 01 Apr 2016 21:57:45 GMT
Repository: hadoop
Updated Branches:
  refs/heads/trunk 256c82fe2 -> 82621e38a


YARN-4895. Add subtractFrom method to ResourceUtilization class. Contributed by Konstantinos
Karanasos.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/82621e38
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/82621e38
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/82621e38

Branch: refs/heads/trunk
Commit: 82621e38a0445832998bc00693279e23a98605c1
Parents: 256c82f
Author: Arun Suresh <asuresh@apache.org>
Authored: Fri Apr 1 14:57:06 2016 -0700
Committer: Arun Suresh <asuresh@apache.org>
Committed: Fri Apr 1 14:57:06 2016 -0700

----------------------------------------------------------------------
 .../yarn/api/records/ResourceUtilization.java   | 22 ++++++++++++++++++++
 1 file changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/82621e38/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ResourceUtilization.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ResourceUtilization.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ResourceUtilization.java
index 5f52f85..2ae4872 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ResourceUtilization.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ResourceUtilization.java
@@ -44,6 +44,14 @@ public abstract class ResourceUtilization implements
     return utilization;
   }
 
+  @Public
+  @Unstable
+  public static ResourceUtilization newInstance(
+      ResourceUtilization resourceUtil) {
+    return newInstance(resourceUtil.getPhysicalMemory(),
+        resourceUtil.getVirtualMemory(), resourceUtil.getCPU());
+  }
+
   /**
    * Get used <em>virtual memory</em>.
    *
@@ -147,4 +155,18 @@ public abstract class ResourceUtilization implements
     this.setVirtualMemory(this.getVirtualMemory() + vmem);
     this.setCPU(this.getCPU() + cpu);
   }
+
+  /**
+   * Subtract utilization from the current one.
+   * @param pmem Physical memory to be subtracted.
+   * @param vmem Virtual memory to be subtracted.
+   * @param cpu CPU utilization to be subtracted.
+   */
+  @Public
+  @Unstable
+  public void subtractFrom(int pmem, int vmem, float cpu) {
+    this.setPhysicalMemory(this.getPhysicalMemory() - pmem);
+    this.setVirtualMemory(this.getVirtualMemory() - vmem);
+    this.setCPU(this.getCPU() - cpu);
+  }
 }
\ No newline at end of file


Mime
View raw message