long nTime = Long.parseLong(mat.group(2)); long sTime = Long.parseLong(mat.group(3)); cpuTimeTracker.updateElapsedJiffies( BigInteger.valueOf(uTime + nTime + sTime), getCurrentTime());
long nTime = Long.parseLong(mat.group(2)); long sTime = Long.parseLong(mat.group(3)); cpuTimeTracker.updateElapsedJiffies( BigInteger.valueOf(uTime + nTime + sTime), getCurrentTime());
@Override public void updateProcessTree() { try { this.processTotalJiffies = readTotalProcessJiffies(); cpuTimeTracker.updateElapsedJiffies(processTotalJiffies, clock.getTime()); } catch (YarnException e) { LOG.warn("Failed to parse " + pid, e); } processPhysicalMemory = getMemorySize(memStat); if (memswStat.exists()) { processVirtualMemory = getMemorySize(memswStat); } else if(LOG.isDebugEnabled()) { LOG.debug("Swap cgroups monitoring is not compiled into the kernel " + memswStat.getAbsolutePath().toString()); } }
/** * Get the CPU usage by all the processes in the process-tree in Unix. * Note: UNAVAILABLE will be returned in case when CPU usage is not * available. It is NOT advised to return any other error code. * * @return percentage CPU usage since the process-tree was created, * {@link #UNAVAILABLE} if CPU usage cannot be calculated or not available. */ @Override public float getCpuUsagePercent() { BigInteger processTotalJiffies = getTotalProcessJiffies(); if (LOG.isDebugEnabled()) { LOG.debug("Process " + pid + " jiffies:" + processTotalJiffies); } cpuTimeTracker.updateElapsedJiffies(processTotalJiffies, clock.getTime()); return cpuTimeTracker.getCpuTrackerUsagePercent(); }
/** * Get the CPU usage by all the processes in the process-tree in Windows. * Note: UNAVAILABLE will be returned in case when CPU usage is not * available. It is NOT advised to return any other error code. * * @return percentage CPU usage since the process-tree was created, * {@link #UNAVAILABLE} if CPU usage cannot be calculated or not available. */ @Override public float getCpuUsagePercent() { BigInteger processTotalMs = getTotalProcessMs(); cpuTimeTracker.updateElapsedJiffies(processTotalMs, clock.getTime()); return cpuTimeTracker.getCpuTrackerUsagePercent(); }