Skip to content

Commit

Permalink
Parse System.gc() events
Browse files Browse the repository at this point in the history
  • Loading branch information
ophillan committed Jul 3, 2017
1 parent 12f8733 commit a340357
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ public class DataReaderShenandoah extends AbstractDataReader {
// Input: [0.693s][info][gc ] GC(0) Pause Init Mark 1.070ms
// Group 1: 0.693
// Group 2: 1.070
// Regex without breaking: ^\[([0-9]+\.[0-9]+)[^\-]*[ ]([0-9]+\.[0-9]+)
private static final Pattern PATTERN_WITHOUT_HEAP = Pattern.compile("^\\[([0-9]+\\.[0-9]+)[^\\-]*[ ]([0-9]+\\.[0-9]+)");
// Regex without breaking: ^\[([0-9]+[.,][0-9]+)[^\-]*[ ]([0-9]+[.,][0-9]+)
private static final Pattern PATTERN_WITHOUT_HEAP = Pattern.compile("^\\[([0-9]+[.,][0-9]+)[^\\-]*[ ]([0-9]+[.,][0-9]+)");

// Input: [13.522s][info][gc ] GC(708) Concurrent evacuation 4848M->4855M(4998M) 2.872ms
// Group 1: 13.522
// Group 2: 4848M->4855M(4998M)
// Group 3: 2.872
// Regex without breaking: ^\[([0-9]+\.[0-9]+).*[ ]([0-9]+[BKMG]\-\>[0-9]+[BKMG]\([0-9]+[BKMG]\)) ([0-9]+\.[0-9]+)
private static final Pattern PATTERN_WITH_HEAP = Pattern.compile("^\\[([0-9]+\\.[0-9]+)" +
// Regex without breaking: ^\[([0-9]+[.,][0-9]+).*[ ]([0-9]+[BKMG]\-\>[0-9]+[BKMG]\([0-9]+[BKMG]\)) ([0-9]+[.,][0-9]+)
private static final Pattern PATTERN_WITH_HEAP = Pattern.compile("^\\[([0-9]+[.,][0-9]+)" +
".*[ ]([0-9]+[BKMG]\\-\\>[0-9]+[BKMG]\\([0-9]+[BKMG]\\)) " +
"([0-9]+\\.[0-9]+)");
"([0-9]+[.,][0-9]+)");

// Input: 4848M->4855M(4998M)
// Group 1: 4848
Expand Down Expand Up @@ -101,8 +101,8 @@ private AbstractGCEvent<?> parseShenandoahEvent(String line) {
} else {
getLogger().warning("Failed to match line with no heap info: " + line);
}
event.setPause(Double.parseDouble(noHeapMatcher.group(NO_HEAP_DURATION)));
event.setTimestamp(Double.parseDouble(noHeapMatcher.group(NO_HEAP_TIMESTAMP)));
event.setPause(Double.parseDouble(noHeapMatcher.group(NO_HEAP_DURATION).replace(",", ".")));
event.setTimestamp(Double.parseDouble(noHeapMatcher.group(NO_HEAP_TIMESTAMP).replace(",", ".")));
} else if (withHeapMatcher.find()) {
// Concurrent events
if (line.contains("Concurrent")) {
Expand Down Expand Up @@ -131,12 +131,14 @@ private AbstractGCEvent<?> parseShenandoahEvent(String line) {
setEventTypes(event, AbstractGCEvent.Type.SHEN_STW_ALLOC_FAILURE);
} else if (line.contains("Pause Final Update Refs")) {
setEventTypes(event, AbstractGCEvent.Type.SHEN_STW_FINAL_UPDATE_REFS);
} else if (line.contains("Pause Full (System.gc())")) {
setEventTypes(event, AbstractGCEvent.Type.SHEN_STW_SYSTEM_GC);
} else {
getLogger().warning("Failed to match line with heap info: " + line);
getLogger().warning("Failed to match line with heap info: " + line);
}
}
event.setPause(Double.parseDouble(withHeapMatcher.group(WITH_HEAP_DURATION)));
event.setTimestamp(Double.parseDouble(withHeapMatcher.group(WITH_HEAP_TIMESTAMP)));
event.setPause(Double.parseDouble(withHeapMatcher.group(WITH_HEAP_DURATION).replace(",", ".")));
event.setTimestamp(Double.parseDouble(withHeapMatcher.group(WITH_HEAP_TIMESTAMP).replace(",", ".")));
addHeapDetailsToEvent(event, withHeapMatcher.group(WITH_HEAP_MEMORY));
} else {
getLogger().warning("Found line that has no match:" + line);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ public String toString() {
public static final Type SHEN_STW_INIT_UPDATE_REFS = new Type("GC Pause Init Update Refs (STW pause)", Generation.TENURED, Concurrency.SERIAL, GcPattern.GC_PAUSE);
public static final Type SHEN_STW_FINAL_UPDATE_REFS = new Type("GC Pause Final Update Refs", Generation.TENURED, Concurrency.SERIAL, GcPattern.GC_PAUSE);
public static final Type SHEN_STW_ALLOC_FAILURE = new Type("GC Pause Full (Allocation Failure)", Generation.TENURED, Concurrency.SERIAL, GcPattern.GC_PAUSE);
public static final Type SHEN_STW_SYSTEM_GC = new Type("GC Pause Full (System.gc())", Generation.TENURED, Concurrency.SERIAL, GcPattern.GC_PAUSE);
// Concurrent events
public static final Type SHEN_CONCURRENT_CONC_MARK = new Type("GC Concurrent marking", Generation.TENURED, Concurrency.CONCURRENT, GcPattern.GC);
public static final Type SHEN_CONCURRENT_CONC_EVAC = new Type("GC Concurrent evacuation", Generation.TENURED, Concurrency.CONCURRENT, GcPattern.GC);
Expand Down

0 comments on commit a340357

Please # to comment.