[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 696494d663
commit 01ada576f3
1 changed files with 7 additions and 2 deletions

View File

@ -653,15 +653,20 @@ public class ContainersMonitorImpl extends AbstractService implements
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(String.format( AUDITLOG.debug(String.format(
"Resource usage of ProcessTree %s for container-id %s:" + "Resource usage of ProcessTree %s for container-id %s:" +
" %s CPU:%f CPU/core:%f", " %s %%CPU: %f %%CPU-cores: %f" +
" vCores-used: %d of %d Cumulative-CPU-ms: %d",
pId, containerId.toString(), pId, containerId.toString(),
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