Skip to content
This repository has been archived by the owner on Nov 5, 2019. It is now read-only.

Commit

Permalink
Break out some scopes in finalizing_build_rule
Browse files Browse the repository at this point in the history
Summary:
There's some big chunks of work in here that we should probably
understand what's taking time.

Reviewed By: styurin

fbshipit-source-id: b690f41537
  • Loading branch information
cjhopman authored and facebook-github-bot committed Mar 22, 2019
1 parent 15949ec commit 6f67bdf
Showing 1 changed file with 26 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -708,26 +708,29 @@ private void finalizeBuiltLocally(AtomicReference<Long> outputSize)
// Push an updated manifest to the cache.
if (manifestRuleKeyManager.useManifestCaching()) {
// TODO(cjhopman): This should be able to use manifestKeySupplier.
Optional<RuleKeyAndInputs> manifestKey = calculateManifestKey(eventBus);
if (manifestKey.isPresent()) {
getBuildInfoRecorder()
.addBuildMetadata(
BuildInfo.MetadataKey.MANIFEST_KEY, manifestKey.get().getRuleKey().toString());

long buildTimeMs =
buildTimestampsMillis == null
? -1
: buildTimestampsMillis.getSecond() - buildTimestampsMillis.getFirst();

ManifestStoreResult manifestStoreResult =
manifestRuleKeyManager.updateAndStoreManifest(
depFileRuleKeyAndInputs.get().getRuleKey(),
depFileRuleKeyAndInputs.get().getInputs(),
manifestKey.get(),
buildTimeMs);
this.buildRuleScopeManager.setManifestStoreResult(manifestStoreResult);
if (manifestStoreResult.getStoreFuture().isPresent()) {
uploadCompleteFuture = manifestStoreResult.getStoreFuture().get();
try (Scope ignored = LeafEvents.scope(eventBus, "updating_and_storing_manifest")) {
Optional<RuleKeyAndInputs> manifestKey = calculateManifestKey(eventBus);
if (manifestKey.isPresent()) {
getBuildInfoRecorder()
.addBuildMetadata(
BuildInfo.MetadataKey.MANIFEST_KEY,
manifestKey.get().getRuleKey().toString());

long buildTimeMs =
buildTimestampsMillis == null
? -1
: buildTimestampsMillis.getSecond() - buildTimestampsMillis.getFirst();

ManifestStoreResult manifestStoreResult =
manifestRuleKeyManager.updateAndStoreManifest(
depFileRuleKeyAndInputs.get().getRuleKey(),
depFileRuleKeyAndInputs.get().getInputs(),
manifestKey.get(),
buildTimeMs);
this.buildRuleScopeManager.setManifestStoreResult(manifestStoreResult);
if (manifestStoreResult.getStoreFuture().isPresent()) {
uploadCompleteFuture = manifestStoreResult.getStoreFuture().get();
}
}
}
}
Expand Down Expand Up @@ -764,7 +767,9 @@ private void finalizeBuiltLocally(AtomicReference<Long> outputSize)
}

if (shouldWriteOutputHashes(outputSize.get())) {
onDiskBuildInfo.writeOutputHashes(fileHashCache);
try (Scope ignored = LeafEvents.scope(eventBus, "computing_output_hashes")) {
onDiskBuildInfo.writeOutputHashes(fileHashCache);
}
}
}

Expand Down

0 comments on commit 6f67bdf

Please sign in to comment.