aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/skyframe/AbstractParallelEvaluator.java
diff options
context:
space:
mode:
authorGravatar felly <felly@google.com>2018-04-17 15:01:04 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-04-17 15:02:31 -0700
commit4b3a075b6d36a909d05bd4387f02d70d0805a80c (patch)
tree7c101aa242dacdf8d5aa9d806e9a99c9b55843aa /src/main/java/com/google/devtools/build/skyframe/AbstractParallelEvaluator.java
parent48ede26053a7a4a206737102f74aa18c71437695 (diff)
Notify Skyframe listeners about additional node states: CHECK_DIRTY, INIT_ENV, and COMMIT.
PiperOrigin-RevId: 193261989
Diffstat (limited to 'src/main/java/com/google/devtools/build/skyframe/AbstractParallelEvaluator.java')
-rw-r--r--src/main/java/com/google/devtools/build/skyframe/AbstractParallelEvaluator.java46
1 files changed, 31 insertions, 15 deletions
diff --git a/src/main/java/com/google/devtools/build/skyframe/AbstractParallelEvaluator.java b/src/main/java/com/google/devtools/build/skyframe/AbstractParallelEvaluator.java
index 1391d00e1b..6ed51ad3f8 100644
--- a/src/main/java/com/google/devtools/build/skyframe/AbstractParallelEvaluator.java
+++ b/src/main/java/com/google/devtools/build/skyframe/AbstractParallelEvaluator.java
@@ -26,6 +26,7 @@ import com.google.devtools.build.lib.profiler.Profiler;
import com.google.devtools.build.lib.profiler.ProfilerTask;
import com.google.devtools.build.lib.util.GroupedList.GroupedListHelper;
import com.google.devtools.build.skyframe.EvaluationProgressReceiver.EvaluationState;
+import com.google.devtools.build.skyframe.EvaluationProgressReceiver.NodeState;
import com.google.devtools.build.skyframe.MemoizingEvaluator.EmittedEventState;
import com.google.devtools.build.skyframe.NodeEntry.DependencyState;
import com.google.devtools.build.skyframe.NodeEntry.DirtyState;
@@ -322,14 +323,26 @@ public abstract class AbstractParallelEvaluator {
NodeEntry state =
Preconditions.checkNotNull(graph.get(null, Reason.EVALUATION, skyKey), skyKey);
Preconditions.checkState(state.isReady(), "%s %s", skyKey, state);
- if (maybeHandleDirtyNode(state) == DirtyOutcome.ALREADY_PROCESSED) {
- return;
+ try {
+ evaluatorContext.getProgressReceiver().stateStarting(skyKey, NodeState.CHECK_DIRTY);
+ if (maybeHandleDirtyNode(state) == DirtyOutcome.ALREADY_PROCESSED) {
+ return;
+ }
+ } finally {
+ evaluatorContext.getProgressReceiver().stateEnding(skyKey, NodeState.CHECK_DIRTY, -1);
}
Set<SkyKey> oldDeps = state.getAllRemainingDirtyDirectDeps();
- SkyFunctionEnvironment env =
- new SkyFunctionEnvironment(
- skyKey, state.getTemporaryDirectDeps(), oldDeps, evaluatorContext);
+ SkyFunctionEnvironment env;
+ try {
+ evaluatorContext.getProgressReceiver().stateStarting(skyKey,
+ NodeState.INITIALIZING_ENVIRONMENT);
+ env = new SkyFunctionEnvironment(skyKey, state.getTemporaryDirectDeps(), oldDeps,
+ evaluatorContext);
+ } finally {
+ evaluatorContext.getProgressReceiver().stateEnding(skyKey,
+ NodeState.INITIALIZING_ENVIRONMENT, -1);
+ }
SkyFunctionName functionName = skyKey.functionName();
SkyFunction factory =
Preconditions.checkNotNull(
@@ -343,12 +356,13 @@ public abstract class AbstractParallelEvaluator {
long startTime = BlazeClock.instance().nanoTime();
try {
try {
- evaluatorContext.getProgressReceiver().computing(skyKey);
+ evaluatorContext.getProgressReceiver().stateStarting(skyKey, NodeState.COMPUTE);
value = factory.compute(skyKey, env);
} finally {
long elapsedTimeNanos = BlazeClock.instance().nanoTime() - startTime;
if (elapsedTimeNanos > 0) {
- evaluatorContext.getProgressReceiver().computed(skyKey, elapsedTimeNanos);
+ evaluatorContext.getProgressReceiver().stateEnding(skyKey, NodeState.COMPUTE,
+ elapsedTimeNanos);
Profiler.instance()
.logSimpleTaskDuration(
startTime,
@@ -440,14 +454,16 @@ public abstract class AbstractParallelEvaluator {
skyKey,
newDirectDeps,
state);
- env.setValue(value);
- registerNewlyDiscoveredDepsForDoneEntry(
- skyKey,
- state,
- oldDeps,
- env,
- evaluatorContext.keepGoing());
- env.commit(state, EnqueueParentBehavior.ENQUEUE);
+
+ try {
+ evaluatorContext.getProgressReceiver().stateStarting(skyKey, NodeState.COMMIT);
+ env.setValue(value);
+ registerNewlyDiscoveredDepsForDoneEntry(
+ skyKey, state, oldDeps, env, evaluatorContext.keepGoing());
+ env.commit(state, EnqueueParentBehavior.ENQUEUE);
+ } finally {
+ evaluatorContext.getProgressReceiver().stateEnding(skyKey, NodeState.COMMIT, -1);
+ }
return;
}