aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/exec
diff options
context:
space:
mode:
authorGravatar ruperts <ruperts@google.com>2017-11-29 04:05:57 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2017-11-29 04:07:53 -0800
commit720d66f1b6de839d64d049e365da04fb4f98fb04 (patch)
tree86785fe8befba0733c3e2ccf3ae5238a0c3300d2 /src/main/java/com/google/devtools/build/lib/exec
parent4d7f8f7846960ffc111cf1aef2a5efb094114442 (diff)
Add user and system time to CommandResults, and plumb them into SpawnResults.
RELNOTES: None PiperOrigin-RevId: 177290508
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/exec')
-rw-r--r--src/main/java/com/google/devtools/build/lib/exec/local/LocalSpawnRunner.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/exec/local/LocalSpawnRunner.java b/src/main/java/com/google/devtools/build/lib/exec/local/LocalSpawnRunner.java
index e99b78b48e..bfc6a8fcbb 100644
--- a/src/main/java/com/google/devtools/build/lib/exec/local/LocalSpawnRunner.java
+++ b/src/main/java/com/google/devtools/build/lib/exec/local/LocalSpawnRunner.java
@@ -291,9 +291,9 @@ public final class LocalSpawnRunner implements SpawnRunner {
}
long startTime = System.currentTimeMillis();
- CommandResult result = null;
+ CommandResult commandResult = null;
try {
- result = cmd.execute(stdOut, stdErr);
+ commandResult = cmd.execute(stdOut, stdErr);
if (Thread.currentThread().isInterrupted()) {
throw new InterruptedException();
}
@@ -301,7 +301,7 @@ public final class LocalSpawnRunner implements SpawnRunner {
if (Thread.currentThread().isInterrupted()) {
throw new InterruptedException();
}
- result = e.getResult();
+ commandResult = e.getResult();
} catch (CommandException e) {
// At the time this comment was written, this must be a ExecFailedException encapsulating
// an IOException from the underlying Subprocess.Factory.
@@ -318,14 +318,15 @@ public final class LocalSpawnRunner implements SpawnRunner {
.build();
}
setState(State.SUCCESS);
+ // TODO(b/62588075): Calculate wall time inside commands instead?
Duration wallTime = Duration.ofMillis(System.currentTimeMillis() - startTime);
boolean wasTimeout =
- result.getTerminationStatus().timedOut()
+ commandResult.getTerminationStatus().timedOut()
|| (useProcessWrapper && wasTimeout(policy.getTimeout(), wallTime));
int exitCode =
wasTimeout
? POSIX_TIMEOUT_EXIT_CODE
- : result.getTerminationStatus().getRawExitCode();
+ : commandResult.getTerminationStatus().getRawExitCode();
Status status =
wasTimeout
? Status.TIMEOUT
@@ -335,6 +336,8 @@ public final class LocalSpawnRunner implements SpawnRunner {
.setExitCode(exitCode)
.setExecutorHostname(hostName)
.setWallTime(wallTime)
+ .setUserTime(commandResult.getUserExecutionTime())
+ .setSystemTime(commandResult.getSystemExecutionTime())
.build();
} finally {
// Delete the temp directory tree, so the next action that this thread executes will get a