aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2018-07-31 07:34:51 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-07-31 07:36:23 -0700
commit1cf5ee39f35628ab8e66935378e80ae6084679ce (patch)
treeb86dcf4d997d7baa829c203f2fa8eb81a95779a3
parent9c9b85f319520f91d48389fc1408c8710af62c29 (diff)
Get newlines back. After the switch to using a JsonWriter, the json profile
output was written all in one line. However, it is really convenient to be able to grep and count over the file (or generally be able to open it in an editor). This change is a bit hacky as just using setIndent makes the file completely expanded with one key-value pair per line, which is also not ideal. With this change, the format is: [ { <entry> }, { <entry> }, ... { <entry> } ] RELNOTES: None PiperOrigin-RevId: 206758496
-rw-r--r--src/main/java/com/google/devtools/build/lib/profiler/Profiler.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/profiler/Profiler.java b/src/main/java/com/google/devtools/build/lib/profiler/Profiler.java
index 2d475f2624..712e9b5ddb 100644
--- a/src/main/java/com/google/devtools/build/lib/profiler/Profiler.java
+++ b/src/main/java/com/google/devtools/build/lib/profiler/Profiler.java
@@ -1046,7 +1046,9 @@ public final class Profiler {
continue;
}
if (data.type == ProfilerTask.THREAD_NAME) {
+ writer.setIndent(" ");
writer.beginObject();
+ writer.setIndent("");
writer.name("name").value("thread_name");
writer.name("ph").value("M");
writer.name("pid").value(1);
@@ -1061,7 +1063,9 @@ public final class Profiler {
continue;
}
String eventType = data.duration == 0 ? "i" : "X";
+ writer.setIndent(" ");
writer.beginObject();
+ writer.setIndent("");
writer.name("cat").value(data.type.description);
writer.name("name").value(data.description);
writer.name("ph").value(eventType);
@@ -1075,6 +1079,7 @@ public final class Profiler {
writer.endObject();
}
receivedPoisonPill = true;
+ writer.setIndent(" ");
writer.endArray();
} catch (IOException e) {
this.savedException = e;