Skip to content

Commit a03674e

Browse files
Googlercopybara-github
authored andcommitted
Use human-readable names for thread names in profile.
PiperOrigin-RevId: 347832512
1 parent 5269579 commit a03674e

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

  • src/main/java/com/google/devtools/build/lib/profiler

src/main/java/com/google/devtools/build/lib/profiler/Profiler.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,18 @@ private void writeTask(JsonWriter writer, TaskData data) throws IOException {
930930
writer.endObject();
931931
}
932932

933+
private static String getReadableName(String threadName) {
934+
if (threadName.startsWith("grpc-command")) {
935+
return "Main Thread";
936+
}
937+
938+
if (threadName.equals("Service Thread")) {
939+
return "Garbage Collector";
940+
}
941+
942+
return threadName;
943+
}
944+
933945
/**
934946
* Saves all gathered information from taskQueue queue to the file.
935947
* Method is invoked internally by the Timer-based thread and at the end of
@@ -985,7 +997,7 @@ public void run() {
985997
writer.name("args");
986998

987999
writer.beginObject();
988-
writer.name("name").value(data.description);
1000+
writer.name("name").value(getReadableName(data.description));
9891001
writer.endObject();
9901002

9911003
writer.endObject();

0 commit comments

Comments
 (0)