Skip to content

Commit

Permalink
Add more profiling spans for pre-execution work.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 598579242
Change-Id: Ia7876efafb29bc9cf798e734567c53ba66cf0821
  • Loading branch information
meisterT authored and copybara-github committed Jan 15, 2024
1 parent 2bfe045 commit df42879
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,9 @@ public AnalysisResult update(
(RuleContextConstraintSemantics) ruleClassProvider.getConstraintSemantics());
// We wait until now to setup for execution, in case the artifact factory was reset
// due to a config change.
Preconditions.checkNotNull(executionSetupCallback).prepareForExecution();
try (SilentCloseable c = Profiler.instance().profile("prepareForExecution")) {
Preconditions.checkNotNull(executionSetupCallback).prepareForExecution();
}
skyframeAnalysisResult =
skyframeBuildView.analyzeAndExecuteTargets(
eventHandler,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,13 +295,17 @@ public void prepareForExecution(Stopwatch executionTimer)
startBuildAndDetermineModifiedOutputFiles(request.getId(), outputService);
if (outputService == null || outputService.actionFileSystemType().supportsLocalActions()) {
// Must be created after the output path is created above.
createActionLogDirectory();
try (SilentCloseable c = Profiler.instance().profile("createActionLogDirectory")) {
createActionLogDirectory();
}
}

ActionCache actionCache = null;
if (buildRequestOptions.useActionCache) {
actionCache = getOrLoadActionCache();
actionCache.resetStatistics();
try (SilentCloseable c = Profiler.instance().profile("load/reset action cache")) {
actionCache = getOrLoadActionCache();
actionCache.resetStatistics();
}
}
SkyframeBuilder skyframeBuilder;
try (SilentCloseable c = Profiler.instance().profile("createBuilder")) {
Expand Down Expand Up @@ -690,7 +694,7 @@ private static void logDeleteTreeFailure(
private void createActionLogDirectory() throws AbruptExitException {
Path directory = env.getActionTempsDirectory();
if (directory.exists()) {
try {
try (SilentCloseable c = Profiler.instance().profile("directory.deleteTree")) {
directory.deleteTree();
} catch (IOException e) {
// TODO(b/140567980): Remove when we determine the cause of occasional deleteTree() failure.
Expand All @@ -702,7 +706,7 @@ private void createActionLogDirectory() throws AbruptExitException {
}
}

try {
try (SilentCloseable c = Profiler.instance().profile("directory.createDirectoryAndParents")) {
directory.createDirectoryAndParents();
} catch (IOException e) {
throw createExitException(
Expand Down

0 comments on commit df42879

Please sign in to comment.