Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import static java.util.Objects.requireNonNull;
import static java.util.concurrent.TimeUnit.NANOSECONDS;

public class PrioritizedSplitRunner
public final class PrioritizedSplitRunner
implements Comparable<PrioritizedSplitRunner>
{
private static final AtomicLong NEXT_WORKER_ID = new AtomicLong();
Expand All @@ -56,9 +56,8 @@ public class PrioritizedSplitRunner

private final AtomicBoolean destroyed = new AtomicBoolean();

protected final AtomicReference<Priority> priority = new AtomicReference<>(new Priority(0, 0));
private final AtomicReference<Priority> priority = new AtomicReference<>(new Priority(0, 0));

protected final AtomicLong lastRun = new AtomicLong();
private final AtomicLong lastReady = new AtomicLong();
private final AtomicLong start = new AtomicLong();

Expand Down Expand Up @@ -92,7 +91,7 @@ public class PrioritizedSplitRunner
this.blockedQuantaWallTime = requireNonNull(blockedQuantaWallTime, "blockedQuantaWallTime is null");
this.unblockedQuantaWallTime = requireNonNull(unblockedQuantaWallTime, "unblockedQuantaWallTime is null");

this.updateLevelPriority();
updateLevelPriority();
}

public TaskHandle getTaskHandle()
Expand Down Expand Up @@ -165,12 +164,10 @@ public ListenableFuture<Void> process()
ListenableFuture<Void> blocked = split.processFor(SPLIT_RUN_QUANTA);
CpuTimer.CpuDuration elapsed = timer.elapsedTime();

long endNanos = ticker.read();
long quantaScheduledNanos = endNanos - startNanos;
long quantaScheduledNanos = elapsed.getWall().roundTo(NANOSECONDS);
Comment thread
dain marked this conversation as resolved.
scheduledNanos.addAndGet(quantaScheduledNanos);

priority.set(taskHandle.addScheduledNanos(quantaScheduledNanos));
lastRun.set(endNanos);

if (blocked == NOT_BLOCKED) {
unblockedQuantaWallTime.add(elapsed.getWall());
Expand Down