aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java
diff options
context:
space:
mode:
authorGravatar ulfjack <ulfjack@google.com>2018-06-11 09:46:50 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-06-11 09:48:24 -0700
commit15b8c259db111012b4642287172cb4d1d82151f3 (patch)
tree0d46f77b5b25bfd67440c102de54c7de5ff05add /src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java
parent6841a748109250f65448627bc5695d537990b686 (diff)
Refactor profiler
- move the save method to an inner class - don't use a timer, use a blocking queue instead - add a format enum (in anticipation of adding a json output format) - update the test to use an in memory buffer, and avoid FoundationTestCase PiperOrigin-RevId: 200065404
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java b/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java
index dcdca11575..a7b1a96a0c 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java
@@ -86,7 +86,6 @@ import com.google.devtools.common.options.OptionsParser;
import com.google.devtools.common.options.OptionsParsingException;
import com.google.devtools.common.options.OptionsProvider;
import com.google.devtools.common.options.TriState;
-import java.io.BufferedOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
@@ -277,7 +276,7 @@ public final class BlazeRuntime {
Path profilePath = env.getWorkspace().getRelative(options.profilePath);
recordFullProfilerData = options.recordFullProfilerData;
- out = new BufferedOutputStream(profilePath.getOutputStream(), 1024 * 1024);
+ out = profilePath.getOutputStream();
env.getReporter().handle(Event.info("Writing profile data to '" + profilePath + "'"));
profiledTasks = ProfiledTaskKinds.ALL;
} else if (options.alwaysProfileSlowOperations) {
@@ -289,8 +288,13 @@ public final class BlazeRuntime {
Profiler.instance().start(
profiledTasks,
out,
- getProductName() + " profile for " + env.getOutputBase() + " at " + new Date()
- + ", build ID: " + buildID,
+ Profiler.Format.BINARY_BAZEL_FORMAT,
+ String.format(
+ "%s profile for %s at %s, build ID: %s",
+ getProductName(),
+ env.getOutputBase(),
+ new Date(),
+ buildID),
recordFullProfilerData,
clock,
execStartTimeNanos);