aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/exec/SymlinkTreeStrategy.java
diff options
context:
space:
mode:
authorGravatar Nathan Harmata <nharmata@google.com>2015-09-08 21:21:04 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2015-09-08 22:27:53 +0000
commit43e22a886ce667a81df337c93f54c727f45966ed (patch)
tree06d3f58efd5a5410f98d17ee82296b8549c2eea2 /src/main/java/com/google/devtools/build/lib/exec/SymlinkTreeStrategy.java
parent68a94d3afa60e7f1b329bfdaa8abd53964f8d841 (diff)
Use AutoProfiler for logging timing info for potentially expensive local actions.
-- MOS_MIGRATED_REVID=102592965
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/exec/SymlinkTreeStrategy.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/exec/SymlinkTreeStrategy.java36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/exec/SymlinkTreeStrategy.java b/src/main/java/com/google/devtools/build/lib/exec/SymlinkTreeStrategy.java
index 2fe14606b4..8cbb9bf114 100644
--- a/src/main/java/com/google/devtools/build/lib/exec/SymlinkTreeStrategy.java
+++ b/src/main/java/com/google/devtools/build/lib/exec/SymlinkTreeStrategy.java
@@ -21,6 +21,9 @@ import com.google.devtools.build.lib.actions.Executor;
import com.google.devtools.build.lib.analysis.SymlinkTreeAction;
import com.google.devtools.build.lib.analysis.SymlinkTreeActionContext;
import com.google.devtools.build.lib.analysis.config.BinTools;
+import com.google.devtools.build.lib.profiler.AutoProfiler;
+
+import java.util.logging.Logger;
/**
* Implements SymlinkTreeAction by using the output service or by running an embedded script to
@@ -28,6 +31,8 @@ import com.google.devtools.build.lib.analysis.config.BinTools;
*/
@ExecutionStrategy(contextType = SymlinkTreeActionContext.class)
public final class SymlinkTreeStrategy implements SymlinkTreeActionContext {
+ private static final Logger LOG = Logger.getLogger(SymlinkTreeStrategy.class.getName());
+
private final OutputService outputService;
private final BinTools binTools;
@@ -41,23 +46,22 @@ public final class SymlinkTreeStrategy implements SymlinkTreeActionContext {
ActionExecutionContext actionExecutionContext)
throws ActionExecutionException, InterruptedException {
Executor executor = actionExecutionContext.getExecutor();
- LocalActionLogging logging = new LocalActionLogging(action);
- try {
- SymlinkTreeHelper helper = new SymlinkTreeHelper(
- action.getInputManifest().getExecPath(),
- action.getOutputManifest().getExecPath().getParentDirectory(), action.isFilesetTree());
- if (outputService != null && outputService.canCreateSymlinkTree()) {
- outputService.createSymlinkTree(action.getInputManifest().getPath(),
- action.getOutputManifest().getPath(),
- action.isFilesetTree(), helper.getSymlinkTreeRoot());
- } else {
- helper.createSymlinks(action, actionExecutionContext, binTools);
+ try (AutoProfiler p = AutoProfiler.logged("running " + action.prettyPrint(), LOG)) {
+ try {
+ SymlinkTreeHelper helper = new SymlinkTreeHelper(
+ action.getInputManifest().getExecPath(),
+ action.getOutputManifest().getExecPath().getParentDirectory(), action.isFilesetTree());
+ if (outputService != null && outputService.canCreateSymlinkTree()) {
+ outputService.createSymlinkTree(action.getInputManifest().getPath(),
+ action.getOutputManifest().getPath(),
+ action.isFilesetTree(), helper.getSymlinkTreeRoot());
+ } else {
+ helper.createSymlinks(action, actionExecutionContext, binTools);
+ }
+ } catch (ExecException e) {
+ throw e.toActionExecutionException(
+ action.getProgressMessage(), executor.getVerboseFailures(), action);
}
- } catch (ExecException e) {
- throw e.toActionExecutionException(
- action.getProgressMessage(), executor.getVerboseFailures(), action);
- } finally {
- logging.finish();
}
}
}