Skip to content

Commit

Permalink
Use human-readable names for thread names in profile.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 347832512
  • Loading branch information
Googler authored and copybara-github committed Dec 16, 2020
1 parent 5269579 commit a03674e
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,18 @@ private void writeTask(JsonWriter writer, TaskData data) throws IOException {
writer.endObject();
}

private static String getReadableName(String threadName) {
if (threadName.startsWith("grpc-command")) {
return "Main Thread";
}

if (threadName.equals("Service Thread")) {
return "Garbage Collector";
}

return threadName;
}

/**
* Saves all gathered information from taskQueue queue to the file.
* Method is invoked internally by the Timer-based thread and at the end of
Expand Down Expand Up @@ -985,7 +997,7 @@ public void run() {
writer.name("args");

writer.beginObject();
writer.name("name").value(data.description);
writer.name("name").value(getReadableName(data.description));
writer.endObject();

writer.endObject();
Expand Down

0 comments on commit a03674e

Please sign in to comment.