|
@@ -96,6 +96,7 @@ public class ContainerImpl implements Container {
|
|
|
private int exitCode = ContainerExitStatus.INVALID;
|
|
|
private final StringBuilder diagnostics;
|
|
|
private boolean wasLaunched;
|
|
|
+ private long containerLocalizationStartTime;
|
|
|
private long containerLaunchStartTime;
|
|
|
private static Clock clock = new SystemClock();
|
|
|
|
|
@@ -493,16 +494,21 @@ public class ContainerImpl implements Container {
|
|
|
// resource usage.
|
|
|
@SuppressWarnings("unchecked") // dispatcher not typed
|
|
|
private void sendContainerMonitorStartEvent() {
|
|
|
- long pmemBytes = getResource().getMemory() * 1024 * 1024L;
|
|
|
- float pmemRatio = daemonConf.getFloat(
|
|
|
- YarnConfiguration.NM_VMEM_PMEM_RATIO,
|
|
|
- YarnConfiguration.DEFAULT_NM_VMEM_PMEM_RATIO);
|
|
|
- long vmemBytes = (long) (pmemRatio * pmemBytes);
|
|
|
- int cpuVcores = getResource().getVirtualCores();
|
|
|
-
|
|
|
- dispatcher.getEventHandler().handle(
|
|
|
- new ContainerStartMonitoringEvent(containerId,
|
|
|
- vmemBytes, pmemBytes, cpuVcores));
|
|
|
+ long launchDuration = clock.getTime() - containerLaunchStartTime;
|
|
|
+ metrics.addContainerLaunchDuration(launchDuration);
|
|
|
+
|
|
|
+ long pmemBytes = getResource().getMemory() * 1024 * 1024L;
|
|
|
+ float pmemRatio = daemonConf.getFloat(
|
|
|
+ YarnConfiguration.NM_VMEM_PMEM_RATIO,
|
|
|
+ YarnConfiguration.DEFAULT_NM_VMEM_PMEM_RATIO);
|
|
|
+ long vmemBytes = (long) (pmemRatio * pmemBytes);
|
|
|
+ int cpuVcores = getResource().getVirtualCores();
|
|
|
+ long localizationDuration = containerLaunchStartTime -
|
|
|
+ containerLocalizationStartTime;
|
|
|
+ dispatcher.getEventHandler().handle(
|
|
|
+ new ContainerStartMonitoringEvent(containerId,
|
|
|
+ vmemBytes, pmemBytes, cpuVcores, launchDuration,
|
|
|
+ localizationDuration));
|
|
|
}
|
|
|
|
|
|
private void addDiagnostics(String... diags) {
|
|
@@ -601,6 +607,7 @@ public class ContainerImpl implements Container {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ container.containerLocalizationStartTime = clock.getTime();
|
|
|
// Send requests for public, private resources
|
|
|
Map<String,LocalResource> cntrRsrc = ctxt.getLocalResources();
|
|
|
if (!cntrRsrc.isEmpty()) {
|
|
@@ -756,8 +763,6 @@ public class ContainerImpl implements Container {
|
|
|
container.sendContainerMonitorStartEvent();
|
|
|
container.metrics.runningContainer();
|
|
|
container.wasLaunched = true;
|
|
|
- long duration = clock.getTime() - container.containerLaunchStartTime;
|
|
|
- container.metrics.addContainerLaunchDuration(duration);
|
|
|
|
|
|
if (container.recoveredAsKilled) {
|
|
|
LOG.info("Killing " + container.containerId
|