Skip to content

Commit

Permalink
Add profiling for file system creation of sandboxed workers.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 580497801
Change-Id: Id86419ddcf93cb1d082f64728028e26e26128816
  • Loading branch information
meisterT authored and copybara-github committed Nov 8, 2023
1 parent 9b91079 commit dc4f54f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/main/java/com/google/devtools/build/lib/worker/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ java_library(
":worker_key",
":worker_protocol",
"//src/main/java/com/google/devtools/build/lib/actions",
"//src/main/java/com/google/devtools/build/lib/profiler",
"//src/main/java/com/google/devtools/build/lib/sandbox:linux_sandbox",
"//src/main/java/com/google/devtools/build/lib/sandbox:linux_sandbox_command_line_builder",
"//src/main/java/com/google/devtools/build/lib/sandbox:linux_sandbox_util",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import com.google.common.collect.Maps;
import com.google.common.flogger.GoogleLogger;
import com.google.devtools.build.lib.actions.UserExecException;
import com.google.devtools.build.lib.profiler.Profiler;
import com.google.devtools.build.lib.profiler.SilentCloseable;
import com.google.devtools.build.lib.sandbox.CgroupsInfo;
import com.google.devtools.build.lib.sandbox.LinuxSandboxCommandLineBuilder;
import com.google.devtools.build.lib.sandbox.LinuxSandboxCommandLineBuilder.BindMount;
Expand Down Expand Up @@ -211,7 +213,9 @@ protected Subprocess createProcess() throws IOException, UserExecException {
public void prepareExecution(
SandboxInputs inputFiles, SandboxOutputs outputs, Set<PathFragment> workerFiles)
throws IOException, InterruptedException, UserExecException {
workerExecRoot.createFileSystem(workerFiles, inputFiles, outputs);
try (SilentCloseable c = Profiler.instance().profile("workerExecRoot.createFileSystem")) {
workerExecRoot.createFileSystem(workerFiles, inputFiles, outputs);
}

super.prepareExecution(inputFiles, outputs, workerFiles);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,8 @@ private WorkResponse executeRequest(
}

Stopwatch executionStopwatch = Stopwatch.createStarted();
try {
try (SilentCloseable c =
Profiler.instance().profile(ProfilerTask.WORKER_SETUP, "sending request")) {
worker.putRequest(request);
} catch (IOException e) {
restoreInterrupt(e);
Expand Down

0 comments on commit dc4f54f

Please sign in to comment.