[YARN-10353] Log vcores used and cumulative cpu in containers monitor.

Contributed by Jim Brennan

(cherry picked from commit 736bed6d6d)
This commit is contained in:
Eric Badger 2020-07-20 18:08:27 +00:00 committed by Eric E Payne
parent ccceec8af0
commit 59e8508ce2

View File

@ -648,15 +648,20 @@ private void recordUsage(ContainerId containerId, String pId,
long vmemLimit = ptInfo.getVmemLimit(); long vmemLimit = ptInfo.getVmemLimit();
long pmemLimit = ptInfo.getPmemLimit(); long pmemLimit = ptInfo.getPmemLimit();
if (AUDITLOG.isDebugEnabled()) { if (AUDITLOG.isDebugEnabled()) {
int vcoreLimit = ptInfo.getCpuVcores();
long cumulativeCpuTime = pTree.getCumulativeCpuTime();
AUDITLOG.debug( AUDITLOG.debug(
"Resource usage of ProcessTree {} for container-id {}:" + "Resource usage of ProcessTree {} for container-id {}:" +
" {} CPU:{} CPU/core:{}", " {} %CPU: {} %CPU-cores: {}" +
" vCores-used: {} of {} Cumulative-CPU-ms: {}",
pId, containerId, pId, containerId,
formatUsageString( formatUsageString(
currentVmemUsage, vmemLimit, currentVmemUsage, vmemLimit,
currentPmemUsage, pmemLimit), currentPmemUsage, pmemLimit),
cpuUsagePercentPerCore, cpuUsagePercentPerCore,
cpuUsageTotalCoresPercentage); cpuUsageTotalCoresPercentage,
milliVcoresUsed / 1000, vcoreLimit,
cumulativeCpuTime);
} }
// Add resource utilization for this container // Add resource utilization for this container