diff options
author | tomlu <tomlu@google.com> | 2018-06-19 15:07:26 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-06-19 15:09:17 -0700 |
commit | a0e8aae4b30a23d6a3069c343a47cd56b5ed3809 (patch) | |
tree | 255a02dc61f029f3495ca7bbee4f54bc1a6fa40c /src/main/java/com/google/devtools/build/skyframe | |
parent | af545684f4f9c2697951d291d00ae2106ff65041 (diff) |
Add new BuildMetrics event to BEP.
To start we add just a single metric, the number of actions constructed in the current build.
RELNOTES: None
PiperOrigin-RevId: 201248490
Diffstat (limited to 'src/main/java/com/google/devtools/build/skyframe')
6 files changed, 25 insertions, 9 deletions
diff --git a/src/main/java/com/google/devtools/build/skyframe/AbstractExceptionalParallelEvaluator.java b/src/main/java/com/google/devtools/build/skyframe/AbstractExceptionalParallelEvaluator.java index 9d7bf274f9..20bf5d5879 100644 --- a/src/main/java/com/google/devtools/build/skyframe/AbstractExceptionalParallelEvaluator.java +++ b/src/main/java/com/google/devtools/build/skyframe/AbstractExceptionalParallelEvaluator.java @@ -153,16 +153,19 @@ public abstract class AbstractExceptionalParallelEvaluator<E extends Exception> // retrieve them, but top-level nodes are presumably of more interest. // If valueVersion is not equal to graphVersion, it must be less than it (by the // Preconditions check above), and so the node is clean. + EvaluationState evaluationState = + valueVersion.equals(evaluatorContext.getGraphVersion()) + ? EvaluationState.BUILT + : EvaluationState.CLEAN; evaluatorContext .getProgressReceiver() .evaluated( key, + evaluationState == EvaluationState.BUILT ? value : null, value != null ? EvaluationSuccessState.SUCCESS.supplier() : EvaluationSuccessState.FAILURE.supplier(), - valueVersion.equals(evaluatorContext.getGraphVersion()) - ? EvaluationState.BUILT - : EvaluationState.CLEAN); + evaluationState); } } 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 0c94277a4b..5381e33bb4 100644 --- a/src/main/java/com/google/devtools/build/skyframe/AbstractParallelEvaluator.java +++ b/src/main/java/com/google/devtools/build/skyframe/AbstractParallelEvaluator.java @@ -286,7 +286,8 @@ public abstract class AbstractParallelEvaluator { // Tell the receiver that the value was not actually changed this run. evaluatorContext .getProgressReceiver() - .evaluated(skyKey, new EvaluationSuccessStateSupplier(state), EvaluationState.CLEAN); + .evaluated( + skyKey, null, new EvaluationSuccessStateSupplier(state), EvaluationState.CLEAN); if (!evaluatorContext.keepGoing() && state.getErrorInfo() != null) { if (!evaluatorContext.getVisitor().preventNewEvaluations()) { return DirtyOutcome.ALREADY_PROCESSED; diff --git a/src/main/java/com/google/devtools/build/skyframe/CompoundEvaluationProgressReceiver.java b/src/main/java/com/google/devtools/build/skyframe/CompoundEvaluationProgressReceiver.java index 9f54ca0f57..259a834874 100644 --- a/src/main/java/com/google/devtools/build/skyframe/CompoundEvaluationProgressReceiver.java +++ b/src/main/java/com/google/devtools/build/skyframe/CompoundEvaluationProgressReceiver.java @@ -15,6 +15,7 @@ package com.google.devtools.build.skyframe; import com.google.common.collect.ImmutableList; import java.util.function.Supplier; +import javax.annotation.Nullable; /** * An {@link EvaluationProgressReceiver} that delegates to a bunch of other @@ -63,10 +64,11 @@ public class CompoundEvaluationProgressReceiver implements EvaluationProgressRec @Override public void evaluated( SkyKey skyKey, + @Nullable SkyValue value, Supplier<EvaluationSuccessState> evaluationSuccessState, EvaluationState state) { for (EvaluationProgressReceiver receiver : receivers) { - receiver.evaluated(skyKey, evaluationSuccessState, state); + receiver.evaluated(skyKey, value, evaluationSuccessState, state); } } } diff --git a/src/main/java/com/google/devtools/build/skyframe/DirtyTrackingProgressReceiver.java b/src/main/java/com/google/devtools/build/skyframe/DirtyTrackingProgressReceiver.java index 820fb51cfe..a8ad00cecd 100644 --- a/src/main/java/com/google/devtools/build/skyframe/DirtyTrackingProgressReceiver.java +++ b/src/main/java/com/google/devtools/build/skyframe/DirtyTrackingProgressReceiver.java @@ -108,10 +108,11 @@ public class DirtyTrackingProgressReceiver implements EvaluationProgressReceiver @Override public void evaluated( SkyKey skyKey, + @Nullable SkyValue value, Supplier<EvaluationSuccessState> evaluationSuccessState, EvaluationState state) { if (progressReceiver != null) { - progressReceiver.evaluated(skyKey, evaluationSuccessState, state); + progressReceiver.evaluated(skyKey, value, evaluationSuccessState, state); } // This key was either built or marked clean, so we can remove it from both the dirty and diff --git a/src/main/java/com/google/devtools/build/skyframe/EvaluationProgressReceiver.java b/src/main/java/com/google/devtools/build/skyframe/EvaluationProgressReceiver.java index d93812b139..09aa231364 100644 --- a/src/main/java/com/google/devtools/build/skyframe/EvaluationProgressReceiver.java +++ b/src/main/java/com/google/devtools/build/skyframe/EvaluationProgressReceiver.java @@ -15,6 +15,7 @@ package com.google.devtools.build.skyframe; import com.google.devtools.build.lib.concurrent.ThreadSafety; import java.util.function.Supplier; +import javax.annotation.Nullable; /** Receiver for various stages of the lifetime of a skyframe node evaluation. */ @ThreadSafety.ThreadSafe @@ -119,9 +120,13 @@ public interface EvaluationProgressReceiver { * * <p>If the value builder threw an error when building this node, then {@code * valueSupplier.get()} evaluates to null. + * + * @param value The sky value. Only available if just evaluated, eg. on success *and* <code> + * state == EvalutionState.BUILT</code> */ void evaluated( SkyKey skyKey, + @Nullable SkyValue value, Supplier<EvaluationSuccessState> evaluationSuccessState, EvaluationState state); @@ -146,6 +151,7 @@ public interface EvaluationProgressReceiver { @Override public void evaluated( SkyKey skyKey, + @Nullable SkyValue value, Supplier<EvaluationSuccessState> evaluationSuccessState, EvaluationState state) {} } diff --git a/src/main/java/com/google/devtools/build/skyframe/SkyFunctionEnvironment.java b/src/main/java/com/google/devtools/build/skyframe/SkyFunctionEnvironment.java index 67b7176193..638a7615ff 100644 --- a/src/main/java/com/google/devtools/build/skyframe/SkyFunctionEnvironment.java +++ b/src/main/java/com/google/devtools/build/skyframe/SkyFunctionEnvironment.java @@ -558,14 +558,17 @@ class SkyFunctionEnvironment extends AbstractSkyFunctionEnvironment { // above, its version stayed below this update's version, so its value remains the same. // We use a SkyValueSupplier here because it keeps a reference to the entry, allowing for // the receiver to be confident that the entry is readily accessible in memory. + EvaluationState evaluationState = + valueVersion.equals(evaluatorContext.getGraphVersion()) + ? EvaluationState.BUILT + : EvaluationState.CLEAN; evaluatorContext .getProgressReceiver() .evaluated( skyKey, + evaluationState == EvaluationState.BUILT ? value : null, new EvaluationSuccessStateSupplier(primaryEntry), - valueVersion.equals(evaluatorContext.getGraphVersion()) - ? EvaluationState.BUILT - : EvaluationState.CLEAN); + evaluationState); evaluatorContext.signalValuesAndEnqueueIfReady( skyKey, reverseDeps, valueVersion, enqueueParents); |