Skip to content

Commit

Permalink
[7.1.0] Add profiling to remoteActionBuildingSemaphore.acquire() (#…
Browse files Browse the repository at this point in the history
…20645)

Without this there can be large gaps in the profile when using remote
execution that are hard to reason about.

Closes #20474.

Commit
75fffbf

PiperOrigin-RevId: 590475989
Change-Id: Ic6e042c36f85e8098a468c73c62bd45cc367423e

Co-authored-by: Brentley Jones <github@brentleyjones.com>
Co-authored-by: Yun Peng <pcloudy@google.com>
  • Loading branch information
3 people authored Jan 11, 2024
1 parent 00bea72 commit 96d0c61
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,10 @@ private ToolSignature getToolSignature(Spawn spawn, SpawnExecutionContext contex
/** Creates a new {@link RemoteAction} instance from spawn. */
public RemoteAction buildRemoteAction(Spawn spawn, SpawnExecutionContext context)
throws IOException, ExecException, ForbiddenActionInputException, InterruptedException {
remoteActionBuildingSemaphore.acquire();
try (SilentCloseable c =
Profiler.instance().profile(ProfilerTask.REMOTE_SETUP, "acquiring semaphore")) {
remoteActionBuildingSemaphore.acquire();
}
try {
// Create a remote path resolver that is aware of the spawn's path mapper, which rewrites
// the paths of the inputs and outputs as well as paths appearing in the command line for
Expand Down Expand Up @@ -1433,7 +1436,10 @@ public void uploadInputsIfNotPresent(RemoteAction action, boolean force)
// concurrency. This prevents memory exhaustion. We assume that
// ensureInputsPresent() provides enough parallelism to saturate the
// network connection.
remoteActionBuildingSemaphore.acquire();
try (SilentCloseable c =
Profiler.instance().profile(ProfilerTask.UPLOAD_TIME, "acquiring semaphore")) {
remoteActionBuildingSemaphore.acquire();
}
try {
MerkleTree merkleTree = action.getMerkleTree();
if (merkleTree == null) {
Expand Down

0 comments on commit 96d0c61

Please sign in to comment.