aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java
diff options
context:
space:
mode:
authorGravatar janakr <janakr@google.com>2018-04-01 19:12:26 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-04-01 19:14:01 -0700
commit52859b454b4426e98d3106c95e5b16e56b5cd437 (patch)
treee7e44cb27fa06fb553ed904a2bb14ea60f86e4a8 /src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java
parentf54d7e5293cc40ce3507a9adef530e46ab817585 (diff)
Change profiling to only accept strings for its "description" argument. Profiling can hold onto objects for the duration of the build, and some of those objects may be temporary that should not be persisted. In particular, UnixGlob and its inner classes should not outlive loading and analysis. For the most part, care was taken in this CL to only use strings that required no additional construction, mainly to minimize garbage (retaining references to newly created strings is not as great a concern since only the strings corresponding to the slowest K tasks are retained, for some relatively small values of K). Action descriptions for actually executing actions are eagerly expanded because that work is minimal compared to the work of actually executing an action.
PiperOrigin-RevId: 191251488
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java
index ff12e07091..49017083e6 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java
@@ -496,7 +496,7 @@ public final class SkyframeActionExecutor implements ActionExecutionContextFacto
long actionStartTime,
Iterable<Artifact> resolvedCacheArtifacts,
Map<String, String> clientEnv) {
- profiler.startTask(ProfilerTask.ACTION_CHECK, action);
+ startProfileAction(ProfilerTask.ACTION_CHECK, action);
Token token =
actionCacheChecker.getTokenIfNeedToExecute(
action, resolvedCacheArtifacts, clientEnv, explain ? reporter : null, metadataHandler);
@@ -641,6 +641,10 @@ public final class SkyframeActionExecutor implements ActionExecutionContextFacto
this.actionInputPrefetcher = actionInputPrefetcher;
}
+ private void startProfileAction(ProfilerTask task, Action action) {
+ profiler.startTask(task, action.describe());
+ }
+
private class ActionRunner implements Callable<ActionExecutionValue> {
private final ExtendedEventHandler eventHandler;
private final Action action;
@@ -666,7 +670,7 @@ public final class SkyframeActionExecutor implements ActionExecutionContextFacto
@Override
public ActionExecutionValue call() throws ActionExecutionException, InterruptedException {
- profiler.startTask(ProfilerTask.ACTION, action);
+ startProfileAction(ProfilerTask.ACTION, action);
try {
if (actionCacheChecker.isActionExecutionProhibited(action)) {
// We can't execute an action (e.g. because --check_???_up_to_date option was used). Fail
@@ -883,7 +887,7 @@ public final class SkyframeActionExecutor implements ActionExecutionContextFacto
Action action,
ActionExecutionContext actionExecutionContext)
throws ActionExecutionException, InterruptedException {
- profiler.startTask(ProfilerTask.ACTION_EXECUTE, action);
+ startProfileAction(ProfilerTask.ACTION_EXECUTE, action);
// ActionExecutionExceptions that occur as the thread is interrupted are
// assumed to be a result of that, so we throw InterruptedException
// instead.
@@ -922,7 +926,7 @@ public final class SkyframeActionExecutor implements ActionExecutionContextFacto
Preconditions.checkState(action.inputsDiscovered(),
"Action %s successfully executed, but inputs still not known", action);
- profiler.startTask(ProfilerTask.ACTION_COMPLETE, action);
+ startProfileAction(ProfilerTask.ACTION_COMPLETE, action);
try {
if (!checkOutputs(action, metadataHandler)) {
reportError("not all outputs were created or valid", null, action,