Fix checks for updating quanta stats
Corrected the blocked/unblocked check to remove the flipped
conditional and use Operator.NOT_BLOCKED.
Removed the isFinished check, as it does not appear to have any
material effect on the reported results, and has unintended side
effects (including test failures).
@@ -59,6 +59,7 @@ import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicLongArray;
import java.util.function.DoubleSupplier;
+import static com.facebook.presto.operator.Operator.NOT_BLOCKED;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkState;
@@ -594,16 +595,13 @@ public class TaskExecutor
priorityLevel.set(calculatePriorityLevel(threadUsageNanos));
long durationMicros = elapsed.getWall().roundTo(MICROSECONDS);
-
- if (!split.isFinished()) {
overallQuantaWallTime.add(durationMicros, MICROSECONDS);
- if (blocked.isDone()) {
- blockedQuantaWallTime.add(durationMicros, MICROSECONDS);
- }
- else {
+ if (blocked == NOT_BLOCKED) {
unblockedQuantaWallTime.add(durationMicros, MICROSECONDS);
}
+ else {
+ blockedQuantaWallTime.add(durationMicros, MICROSECONDS);
}
// record last run for prioritization within a level
