Buffer profile output to amortize heavy cost of Blaze server-->client output.
@@ -222,7 +222,7 @@ public final class ProfileCommand implements BlazeCommand {
opts.vfsStatsLimit = 0;
}
- try (PrintStream out = new PrintStream(env.getReporter().getOutErr().getOutputStream())) {
+ try (PrintStream out = getOutputStream(env)) {
env.getReporter()
.handle(
Event.warn(
@@ -339,6 +339,11 @@ public final class ProfileCommand implements BlazeCommand {
return BlazeCommandResult.exitCode(ExitCode.SUCCESS);
}
+ private static PrintStream getOutputStream(CommandEnvironment env) {
+ return new PrintStream(
+ new BufferedOutputStream(env.getReporter().getOutErr().getOutputStream()), false);
+ }
+
/**
* Prints trees rooted at tasks with a description matching a pattern.
* @see Task#printTaskTree(PrintStream, long)
