Skip to content

Commit

Permalink
goroutine parsing tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
plorenz committed May 29, 2024
1 parent 6bacad1 commit 5a0a71e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/goroutine/analyzer/StackDumpParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.util.regex.Pattern;

public class StackDumpParser {
private final Pattern stackStart = Pattern.compile("^goroutine (\\d+) \\[([^,]+)(, (\\d+) minutes)?]:$");
private final Pattern stackStart = Pattern.compile("^goroutine (\\d+)(?: [a-zA-Z0-9]*=[a-zA-Z0-9]*)* \\[([^,]+)(, (\\d+) minutes)?]:$");
private final Pattern elemFirst = Pattern.compile("^(created by )?(?:(.*/)*)?([^.]+)(?:\\.([^.]+))?\\.([^(]*)(?:\\((.*)\\))?");
private final Pattern sourcePattern = Pattern.compile("\\w*(.+):(\\d+).*");

Expand All @@ -30,7 +30,7 @@ public void processLine(String line) {
current = new Stack(null, id, state, time, line);
stacks.add(current);

System.out.printf("goroutine %s [%s, %d minutes]\n", current.header.id, current.header.state, current.header.time);
// System.out.printf("goroutine %s [%s, %d minutes]\n", current.header.id, current.header.state, current.header.time);
return;
}

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/goroutine/analyzer/State.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

public enum State {
Running,
Runnable,
Sleep,
Select,
IOWait,
Expand All @@ -16,6 +17,8 @@ public static State getState(String state) {
switch (state) {
case "running" :
return Running;
case "runnable" :
return Runnable;
case "sleep":
return Sleep;
case "select":
Expand Down

0 comments on commit 5a0a71e

Please sign in to comment.