Search in sources :

Example 11 with OperatorProfile

use of org.apache.drill.exec.proto.UserBitShared.OperatorProfile in project drill by apache.

the class ProfileWrapper method tallyMajorFragmentCost.

private long tallyMajorFragmentCost(List<MajorFragmentProfile> majorFragments) {
    long globalProcessNanos = 0L;
    for (MajorFragmentProfile majorFP : majorFragments) {
        String majorFragmentId = new OperatorPathBuilder().setMajor(majorFP).build();
        long processNanos = 0L;
        for (MinorFragmentProfile minorFP : majorFP.getMinorFragmentProfileList()) {
            for (OperatorProfile op : minorFP.getOperatorProfileList()) {
                processNanos += op.getProcessNanos();
            }
        }
        majorFragmentTallyMap.put(majorFragmentId, processNanos);
        globalProcessNanos += processNanos;
    }
    return globalProcessNanos;
}
Also used : MajorFragmentProfile(org.apache.drill.exec.proto.UserBitShared.MajorFragmentProfile) OperatorProfile(org.apache.drill.exec.proto.UserBitShared.OperatorProfile) MinorFragmentProfile(org.apache.drill.exec.proto.UserBitShared.MinorFragmentProfile)

Example 12 with OperatorProfile

use of org.apache.drill.exec.proto.UserBitShared.OperatorProfile in project drill by axbaretto.

the class FragmentWrapper method getContent.

public String getContent() {
    final TableBuilder builder = new TableBuilder(FRAGMENT_COLUMNS, FRAGMENT_COLUMNS_TOOLTIP, true);
    // Use only minor fragments that have complete profiles
    // Complete iff the fragment profile has at least one operator profile, and start and end times.
    final List<MinorFragmentProfile> complete = new ArrayList<>(Collections2.filter(major.getMinorFragmentProfileList(), Filters.hasOperatorsAndTimes));
    final List<MinorFragmentProfile> incomplete = new ArrayList<>(Collections2.filter(major.getMinorFragmentProfileList(), Filters.missingOperatorsOrTimes));
    Collections.sort(complete, Comparators.minorId);
    // Reusing for different fragments
    Map<String, String> attributeMap = new HashMap<String, String>();
    for (final MinorFragmentProfile minor : complete) {
        final ArrayList<OperatorProfile> ops = new ArrayList<>(minor.getOperatorProfileList());
        long biggestIncomingRecords = 0;
        long biggestBatches = 0;
        for (final OperatorProfile op : ops) {
            long incomingRecords = 0;
            long batches = 0;
            for (final StreamProfile sp : op.getInputProfileList()) {
                incomingRecords += sp.getRecords();
                batches += sp.getBatches();
            }
            biggestIncomingRecords = Math.max(biggestIncomingRecords, incomingRecords);
            biggestBatches = Math.max(biggestBatches, batches);
        }
        // Overwrite values from previous fragments
        attributeMap.put("data-order", String.valueOf(minor.getMinorFragmentId()));
        builder.appendCell(new OperatorPathBuilder().setMajor(major).setMinor(minor).build(), attributeMap);
        builder.appendCell(minor.getEndpoint().getAddress());
        builder.appendMillis(minor.getStartTime() - start);
        builder.appendMillis(minor.getEndTime() - start);
        builder.appendMillis(minor.getEndTime() - minor.getStartTime());
        builder.appendFormattedInteger(biggestIncomingRecords);
        builder.appendFormattedInteger(biggestBatches);
        builder.appendTime(minor.getLastUpdate());
        builder.appendTime(minor.getLastProgress());
        builder.appendBytes(minor.getMaxMemoryUsed());
        builder.appendCell(minor.getState().name());
    }
    for (final MinorFragmentProfile m : incomplete) {
        builder.appendCell(major.getMajorFragmentId() + "-" + m.getMinorFragmentId());
        builder.appendRepeated(m.getState().toString(), null, NUM_NULLABLE_FRAGMENTS_COLUMNS);
    }
    return builder.build();
}
Also used : HashMap(java.util.HashMap) OperatorProfile(org.apache.drill.exec.proto.UserBitShared.OperatorProfile) ArrayList(java.util.ArrayList) MinorFragmentProfile(org.apache.drill.exec.proto.UserBitShared.MinorFragmentProfile) StreamProfile(org.apache.drill.exec.proto.UserBitShared.StreamProfile)

Example 13 with OperatorProfile

use of org.apache.drill.exec.proto.UserBitShared.OperatorProfile in project drill by axbaretto.

the class OperatorWrapper method getContent.

public String getContent() {
    TableBuilder builder = new TableBuilder(OPERATOR_COLUMNS, OPERATOR_COLUMNS_TOOLTIP, true);
    // Reusing for different fragments
    Map<String, String> attributeMap = new HashMap<String, String>();
    for (ImmutablePair<ImmutablePair<OperatorProfile, Integer>, String> ip : opsAndHosts) {
        int minor = ip.getLeft().getRight();
        OperatorProfile op = ip.getLeft().getLeft();
        // Overwrite values from previous fragments
        attributeMap.put("data-order", String.valueOf(minor));
        String path = new OperatorPathBuilder().setMajor(major).setMinor(minor).setOperator(op).build();
        builder.appendCell(path, attributeMap);
        builder.appendCell(ip.getRight());
        builder.appendNanos(op.getSetupNanos());
        builder.appendNanos(op.getProcessNanos());
        builder.appendNanos(op.getWaitNanos());
        long maxBatches = Long.MIN_VALUE;
        long maxRecords = Long.MIN_VALUE;
        for (StreamProfile sp : op.getInputProfileList()) {
            maxBatches = Math.max(sp.getBatches(), maxBatches);
            maxRecords = Math.max(sp.getRecords(), maxRecords);
        }
        builder.appendFormattedInteger(maxBatches);
        builder.appendFormattedInteger(maxRecords);
        builder.appendBytes(op.getPeakLocalMemoryAllocated());
    }
    return builder.build();
}
Also used : ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) HashMap(java.util.HashMap) OperatorProfile(org.apache.drill.exec.proto.UserBitShared.OperatorProfile) StreamProfile(org.apache.drill.exec.proto.UserBitShared.StreamProfile)

Example 14 with OperatorProfile

use of org.apache.drill.exec.proto.UserBitShared.OperatorProfile in project drill by axbaretto.

the class ProfileWrapper method tallyMajorFragmentCost.

private long tallyMajorFragmentCost(List<MajorFragmentProfile> majorFragments) {
    long globalProcessNanos = 0L;
    for (MajorFragmentProfile majorFP : majorFragments) {
        String majorFragmentId = new OperatorPathBuilder().setMajor(majorFP).build();
        long processNanos = 0L;
        for (MinorFragmentProfile minorFP : majorFP.getMinorFragmentProfileList()) {
            for (OperatorProfile op : minorFP.getOperatorProfileList()) {
                processNanos += op.getProcessNanos();
            }
        }
        majorFragmentTallyMap.put(majorFragmentId, processNanos);
        globalProcessNanos += processNanos;
    }
    return globalProcessNanos;
}
Also used : MajorFragmentProfile(org.apache.drill.exec.proto.UserBitShared.MajorFragmentProfile) OperatorProfile(org.apache.drill.exec.proto.UserBitShared.OperatorProfile) MinorFragmentProfile(org.apache.drill.exec.proto.UserBitShared.MinorFragmentProfile)

Example 15 with OperatorProfile

use of org.apache.drill.exec.proto.UserBitShared.OperatorProfile in project drill by axbaretto.

the class OperatorStats method getProfile.

public OperatorProfile getProfile() {
    final OperatorProfile.Builder b = // 
    OperatorProfile.newBuilder().setOperatorType(// 
    operatorType).setOperatorId(// 
    operatorId).setSetupNanos(// 
    setupNanos).setProcessNanos(processingNanos).setWaitNanos(waitNanos);
    if (allocator != null) {
        b.setPeakLocalMemoryAllocated(allocator.getPeakMemoryAllocation());
    }
    addAllMetrics(b);
    return b.build();
}
Also used : Builder(org.apache.drill.exec.proto.UserBitShared.OperatorProfile.Builder) OperatorProfile(org.apache.drill.exec.proto.UserBitShared.OperatorProfile)

Aggregations

OperatorProfile (org.apache.drill.exec.proto.UserBitShared.OperatorProfile)19 ArrayList (java.util.ArrayList)8 MinorFragmentProfile (org.apache.drill.exec.proto.UserBitShared.MinorFragmentProfile)8 HashMap (java.util.HashMap)7 StreamProfile (org.apache.drill.exec.proto.UserBitShared.StreamProfile)7 ImmutablePair (org.apache.commons.lang3.tuple.ImmutablePair)6 MetricValue (org.apache.drill.exec.proto.UserBitShared.MetricValue)3 InputStream (java.io.InputStream)2 TreeSet (java.util.TreeSet)2 OpProfileDef (org.apache.drill.exec.ops.OpProfileDef)2 OperatorStats (org.apache.drill.exec.ops.OperatorStats)2 MajorFragmentProfile (org.apache.drill.exec.proto.UserBitShared.MajorFragmentProfile)2 Builder (org.apache.drill.exec.proto.UserBitShared.OperatorProfile.Builder)2 Configuration (org.apache.hadoop.conf.Configuration)2 Path (org.apache.hadoop.fs.Path)2 Test (org.junit.Test)2 CoreOperatorType (org.apache.drill.exec.server.rest.profile.CoreOperatorType)1 BaseTest (org.apache.drill.test.BaseTest)1