From 59e8508ce29d1270da568eb44119b5844cb9bc5a Mon Sep 17 00:00:00 2001 From: Eric Badger Date: Mon, 20 Jul 2020 18:08:27 +0000 Subject: [PATCH] [YARN-10353] Log vcores used and cumulative cpu in containers monitor. Contributed by Jim Brennan (cherry picked from commit 736bed6d6d20a17b522a0686ca3fd2d97e7e6838) --- .../containermanager/monitor/ContainersMonitorImpl.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/monitor/ContainersMonitorImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/monitor/ContainersMonitorImpl.java index 8792910192..8f401df89d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/monitor/ContainersMonitorImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/monitor/ContainersMonitorImpl.java @@ -648,15 +648,20 @@ private void recordUsage(ContainerId containerId, String pId, long vmemLimit = ptInfo.getVmemLimit(); long pmemLimit = ptInfo.getPmemLimit(); if (AUDITLOG.isDebugEnabled()) { + int vcoreLimit = ptInfo.getCpuVcores(); + long cumulativeCpuTime = pTree.getCumulativeCpuTime(); AUDITLOG.debug( "Resource usage of ProcessTree {} for container-id {}:" + - " {} CPU:{} CPU/core:{}", + " {} %CPU: {} %CPU-cores: {}" + + " vCores-used: {} of {} Cumulative-CPU-ms: {}", pId, containerId, formatUsageString( currentVmemUsage, vmemLimit, currentPmemUsage, pmemLimit), cpuUsagePercentPerCore, - cpuUsageTotalCoresPercentage); + cpuUsageTotalCoresPercentage, + milliVcoresUsed / 1000, vcoreLimit, + cumulativeCpuTime); } // Add resource utilization for this container