Exemplo n.º 1
0
  public boolean instanceAllocatedByJob(InternalInstanceProfilingData instanceProfilingData) {

    final ExecutionGroupVertexIterator it =
        new ExecutionGroupVertexIterator(
            this.executionGraph, true, this.executionGraph.getIndexOfCurrentExecutionStage());
    while (it.hasNext()) {

      final ExecutionGroupVertex groupVertex = it.next();
      for (int i = 0; i < groupVertex.getCurrentNumberOfGroupMembers(); i++) {
        final ExecutionVertex executionVertex = groupVertex.getGroupMember(i);
        if (instanceProfilingData
            .getInstanceConnectionInfo()
            .equals(
                executionVertex.getAllocatedResource().getInstance().getInstanceConnectionInfo())) {
          this.collectedInstanceProfilingData.put(
              instanceProfilingData.getInstanceConnectionInfo(), instanceProfilingData);
          return true;
        }
      }
    }

    return false;
  }
Exemplo n.º 2
0
  private InstanceSummaryProfilingEvent constructInstanceSummary(long timestamp) {

    final int numberOfInstances = this.collectedInstanceProfilingData.size();
    final Iterator<InstanceConnectionInfo> instanceIterator =
        this.collectedInstanceProfilingData.keySet().iterator();

    long freeMemorySum = 0;
    long totalMemorySum = 0;
    long bufferedMemorySum = 0;
    long cachedMemorySum = 0;
    long cachedSwapMemorySum = 0;

    int ioWaitCPUSum = 0;
    int idleCPUSum = 0;
    int profilingIntervalSum = 0;
    int systemCPUSum = 0;
    int hardIrqCPUSum = 0;
    int softIrqCPUSum = 0;

    int userCPUSum = 0;
    long receivedBytesSum = 0;
    long transmittedBytesSum = 0;

    // Sum up the individual values
    while (instanceIterator.hasNext()) {

      final InternalInstanceProfilingData profilingData =
          this.collectedInstanceProfilingData.get(instanceIterator.next());

      freeMemorySum += profilingData.getFreeMemory();
      ioWaitCPUSum += profilingData.getIOWaitCPU();
      idleCPUSum += profilingData.getIdleCPU();
      profilingIntervalSum += profilingData.getProfilingInterval();
      systemCPUSum += profilingData.getSystemCPU();
      hardIrqCPUSum += profilingData.getHardIrqCPU();
      softIrqCPUSum += profilingData.getSoftIrqCPU();
      totalMemorySum += profilingData.getTotalMemory();
      userCPUSum += profilingData.getUserCPU();
      receivedBytesSum += profilingData.getReceivedBytes();
      transmittedBytesSum += profilingData.getTransmittedBytes();
      bufferedMemorySum += profilingData.getBufferedMemory();
      cachedMemorySum += profilingData.getCachedMemory();
      cachedSwapMemorySum += profilingData.getCachedSwapMemory();
    }

    final InstanceSummaryProfilingEvent instanceSummary =
        new InstanceSummaryProfilingEvent(
            profilingIntervalSum / numberOfInstances,
            ioWaitCPUSum / numberOfInstances,
            idleCPUSum / numberOfInstances,
            userCPUSum / numberOfInstances,
            systemCPUSum / numberOfInstances,
            hardIrqCPUSum / numberOfInstances,
            softIrqCPUSum / numberOfInstances,
            totalMemorySum / (long) numberOfInstances,
            freeMemorySum / (long) numberOfInstances,
            bufferedMemorySum / (long) numberOfInstances,
            cachedMemorySum / (long) numberOfInstances,
            cachedSwapMemorySum / (long) numberOfInstances,
            receivedBytesSum / (long) numberOfInstances,
            transmittedBytesSum / (long) numberOfInstances,
            this.executionGraph.getJobID(),
            timestamp,
            (timestamp - this.profilingStart));

    this.collectedInstanceProfilingData.clear();

    return instanceSummary;
  }