Skip to content

Commit

Permalink
add a bunch of print statements
Browse files Browse the repository at this point in the history
  • Loading branch information
Wyverald committed May 23, 2024
1 parent 7f2a9a8 commit b10ade7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,10 @@ class RepoFetchingSkyKeyComputeState implements SkyKeyComputeState {
* new map on each restart, so we can't simply plumb that in.
*/
final Map<RepoRecordedInput, String> recordedInputValues = new TreeMap<>();
private final String repoName;

RepoFetchingSkyKeyComputeState(String repoName) {
this.repoName = repoName;
workerExecutorService =
MoreExecutors.listeningDecorator(
Executors.newThreadPerTaskExecutor(
Expand Down Expand Up @@ -114,10 +116,12 @@ synchronized void startWorker(Callable<RepositoryDirectoryValue.Builder> c) {
// high-memory-pressure listener thread.
@Override
public synchronized void close() {
System.out.println("WYVDEBUG -- closing state: " + repoName);
if (workerFuture != null) {
workerFuture.cancel(true);
}
workerFuture = null;
workerExecutorService.close(); // This blocks
System.out.println("WYVDEBUG -- closed state: " + repoName);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ public RepositoryDirectoryValue.Builder fetch(
}
// See below (the `catch CancellationException` clause) for why there's a `while` loop here.
while (true) {
System.out.println("WYVDEBUG -- about to get new state: " + rule.getName());
var state = env.getState(() -> new RepoFetchingSkyKeyComputeState(rule.getName()));
boolean shouldShutDownWorkerExecutorInFinally = true;
try {
Expand Down Expand Up @@ -195,7 +196,9 @@ public RepositoryDirectoryValue.Builder fetch(
// our knowledge, and 2) if the SkyFunction is re-entered for any reason (for example
// b/330892334 and https://github.com/bazelbuild/bazel/issues/21238), we don't have
// lingering state messing things up.
System.out.println("WYVDEBUG -- before finally clearState: " + rule.getName());
env.clearState();
System.out.println("WYVDEBUG -- after finally clearState: " + rule.getName());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.google.devtools.build.lib.runtime.MemoryPressureOptions;
import com.google.devtools.build.lib.runtime.MemoryPressureStatCollector;
import com.google.devtools.build.lib.vfs.SyscallCache;
import java.text.NumberFormat;

/**
* Drops unnecessary temporary state in response to memory pressure.
Expand Down Expand Up @@ -95,6 +96,14 @@ void handle(MemoryPressureEvent event) {
actual, threshold, remainingStat);
}

System.out.println(
"WYVDEBUG -- DROPPING STATE! "
+ NumberFormat.getInstance().format(event.tenuredSpaceUsedBytes())
+ "B used, "
+ NumberFormat.getInstance().format(event.tenuredSpaceMaxBytes())
+ "B max ("
+ actual
+ "%)");
skyframeExecutor.dropUnnecessaryTemporarySkyframeState();
syscallCache.clear();
}
Expand Down

0 comments on commit b10ade7

Please sign in to comment.