Skip to content

Commit

Permalink
Merge branch 'pull/216/add-support-for-zgc-logging' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
chewiebug committed Jun 10, 2019
2 parents 0a9d25d + 2a2535c commit 01fa608
Show file tree
Hide file tree
Showing 21 changed files with 1,062 additions and 198 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,14 @@ public ExtendedType parseTypeWithCause(String typeName) {
typeName = typeName.trim();
ExtendedType extendedType = null;
String lookupTypeName = getLookupTypeName(typeName);

AbstractGCEvent.Type gcType = AbstractGCEvent.Type.lookup(lookupTypeName);
// the gcType may be null because there was a PrintGCCause flag enabled - if so, reparse it with the first paren set stripped
// the gcType may be null because there was a PrintGCCause flag enabled - if so, reparse it with the first parentheses set stripped
if (gcType == null) {
// try to parse it again with the parens removed
Matcher parenMatcher = parenthesesPattern.matcher(lookupTypeName);
if (parenMatcher.find()) {
gcType = AbstractGCEvent.Type.lookup(parenMatcher.replaceFirst(""));
// try to parse it again with the parentheses removed
Matcher parenthesesMatcher = parenthesesPattern.matcher(lookupTypeName);
if (parenthesesMatcher.find()) {
gcType = AbstractGCEvent.Type.lookup(parenthesesMatcher.replaceFirst(""));
}
}

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public abstract class AbstractGCEvent<T extends AbstractGCEvent<T>> implements S
protected List<T> details;
private double pause;
private int number = -1;
private List<AbstractGCEvent<?>> phases;

public Iterator<T> details() {
if (details == null) return Collections.emptyIterator();
Expand All @@ -59,6 +60,24 @@ public boolean hasDetails() {
&& details.size() > 0;
}

public List<AbstractGCEvent<?>> getPhases() {
if (phases == null) {
return new ArrayList<>();
}
return phases;
}

public void addPhase(AbstractGCEvent<?> phase) {
if (phase == null) {
throw new IllegalArgumentException("Cannot add null phase to an event");
}
if (phases == null) {
phases = new ArrayList<>();
}

phases.add(phase);
}

@Override
protected Object clone() throws CloneNotSupportedException {
AbstractGCEvent<T> clonedEvent = (AbstractGCEvent<T>)super.clone();
Expand Down Expand Up @@ -615,6 +634,19 @@ public String toString() {
public static final Type UJL_PAUSE_YOUNG = new Type("Pause Young", Generation.YOUNG, Concurrency.SERIAL, GcPattern.GC_MEMORY_PAUSE);
public static final Type UJL_PAUSE_FULL = new Type("Pause Full", Generation.ALL, Concurrency.SERIAL, GcPattern.GC_MEMORY_PAUSE);

// unified jvm logging serial / cms event phase types
public static final Type UJL_SERIAL_PHASE_MARK_LIFE_OBJECTS = new Type("Phase 1: Mark live objects", Generation.YOUNG, Concurrency.SERIAL, GcPattern.GC_PAUSE);
public static final Type UJL_SERIAL_PHASE_COMPUTE_NEW_OBJECT_ADDRESSES = new Type("Phase 2: Compute new object addresses", Generation.YOUNG, Concurrency.SERIAL, GcPattern.GC_PAUSE);
public static final Type UJL_SERIAL_PHASE_ADJUST_POINTERS = new Type("Phase 3: Adjust pointers", Generation.YOUNG, Concurrency.SERIAL, GcPattern.GC_PAUSE);
public static final Type UJL_SERIAL_PHASE_MOVE_OBJECTS = new Type("Phase 4: Move objects", Generation.YOUNG, Concurrency.SERIAL, GcPattern.GC_PAUSE);

// unified jvm logging parallel event phase types
public static final Type UJL_PARALLEL_PHASE_MARKING = new Type("Marking Phase", Generation.YOUNG, Concurrency.SERIAL, GcPattern.GC_PAUSE);
public static final Type UJL_PARALLEL_PHASE_SUMMARY = new Type("Summary Phase", Generation.YOUNG, Concurrency.SERIAL, GcPattern.GC_PAUSE);
public static final Type UJL_PARALLEL_PHASE_ADJUST_ROOTS = new Type("Adjust Roots", Generation.YOUNG, Concurrency.SERIAL, GcPattern.GC_PAUSE);
public static final Type UJL_PARALLEL_PHASE_COMPACTION = new Type("Compaction Phase", Generation.YOUNG, Concurrency.SERIAL, GcPattern.GC_PAUSE);
public static final Type UJL_PARALLEL_PHASE_POST_COMPACT = new Type("Post Compact", Generation.YOUNG, Concurrency.SERIAL, GcPattern.GC_PAUSE);

// unified jvm logging cms / g1 event types
public static final Type UJL_PAUSE_INITIAL_MARK = new Type("Pause Initial Mark", Generation.TENURED, Concurrency.SERIAL, GcPattern.GC_MEMORY_PAUSE, CollectionType.CONCURRENCY_HELPER);
public static final Type UJL_PAUSE_REMARK = new Type("Pause Remark", Generation.TENURED, Concurrency.SERIAL, GcPattern.GC_MEMORY_PAUSE, CollectionType.CONCURRENCY_HELPER);
Expand All @@ -637,6 +669,11 @@ public String toString() {
public static final Type UJL_G1_OLD = new Type("Old regions", Generation.TENURED, Concurrency.SERIAL, GcPattern.GC_REGION);
public static final Type UJL_G1_HUMongous = new Type("Humongous regions", Generation.TENURED, Concurrency.SERIAL, GcPattern.GC_REGION);

public static final Type UJL_G1_PHASE_PRE_EVACUATE_COLLECTION_SET = new Type("Pre Evacuate Collection Set", Generation.YOUNG, Concurrency.SERIAL, GcPattern.GC_PAUSE);
public static final Type UJL_G1_PHASE_EVACUATE_COLLECTION_SET = new Type("Evacuate Collection Set", Generation.YOUNG, Concurrency.SERIAL, GcPattern.GC_PAUSE);
public static final Type UJL_G1_PHASE_POST_EVACUATE_COLLECTION_SET = new Type("Post Evacuate Collection Set", Generation.YOUNG, Concurrency.SERIAL, GcPattern.GC_PAUSE);
public static final Type UJL_G1_PHASE_OTHER = new Type("Other", Generation.YOUNG, Concurrency.SERIAL, GcPattern.GC_PAUSE);

// unified jvm logging shenandoah event types
public static final Type UJL_SHEN_INIT_MARK = new Type("Pause Init Mark", Generation.TENURED, Concurrency.SERIAL, GcPattern.GC_PAUSE);
public static final Type UJL_SHEN_FINAL_MARK = new Type("Pause Final Mark", Generation.TENURED, Concurrency.SERIAL, GcPattern.GC_MEMORY_PAUSE);
Expand All @@ -649,6 +686,20 @@ public String toString() {
public static final Type UJL_SHEN_CONCURRENT_CONC_UPDATE_REFS = new Type("Concurrent update references", Generation.TENURED, Concurrency.CONCURRENT, GcPattern.GC_MEMORY_PAUSE);
public static final Type UJL_SHEN_CONCURRENT_PRECLEANING = new Type("Concurrent precleaning", Generation.TENURED, Concurrency.CONCURRENT, GcPattern.GC_MEMORY_PAUSE);

// unified jvm logging ZGC event types
public static final Type UJL_ZGC_GARBAGE_COLLECTION = new Type("Garbage Collection", Generation.TENURED, Concurrency.SERIAL, GcPattern.GC_MEMORY_PERCENTAGE);
public static final Type UJL_ZGC_PAUSE_MARK_START = new Type("Pause Mark Start", Generation.TENURED, Concurrency.SERIAL, GcPattern.GC_PAUSE);
public static final Type UJL_ZGC_PAUSE_MARK_END = new Type("Pause Mark End", Generation.TENURED, Concurrency.SERIAL, GcPattern.GC_PAUSE);
public static final Type UJL_ZGC_PAUSE_RELOCATE_START = new Type("Pause Relocate Start", Generation.TENURED, Concurrency.SERIAL, GcPattern.GC_PAUSE);
public static final Type UJL_ZGC_CONCURRENT_MARK = new Type("Concurrent Mark", Generation.TENURED, Concurrency.CONCURRENT, GcPattern.GC_PAUSE);
public static final Type UJL_ZGC_CONCURRENT_NONREF = new Type("Concurrent Process Non-Strong References", Generation.TENURED, Concurrency.CONCURRENT, GcPattern.GC_PAUSE);
public static final Type UJL_ZGC_CONCURRENT_RESET_RELOC_SET = new Type("Concurrent Reset Relocation Set", Generation.TENURED, Concurrency.CONCURRENT, GcPattern.GC_PAUSE);
public static final Type UJL_ZGC_CONCURRENT_DETATCHED_PAGES = new Type("Concurrent Destroy Detached Pages", Generation.TENURED, Concurrency.CONCURRENT, GcPattern.GC_PAUSE);
public static final Type UJL_ZGC_CONCURRENT_SELECT_RELOC_SET = new Type("Concurrent Select Relocation Set", Generation.TENURED, Concurrency.CONCURRENT, GcPattern.GC_PAUSE);
public static final Type UJL_ZGC_CONCURRENT_PREPARE_RELOC_SET = new Type("Concurrent Prepare Relocation Set", Generation.TENURED, Concurrency.CONCURRENT, GcPattern.GC_PAUSE);
public static final Type UJL_ZGC_CONCURRENT_RELOCATE = new Type("Concurrent Relocate", Generation.TENURED, Concurrency.CONCURRENT, GcPattern.GC_PAUSE);
public static final Type UJL_ZGC_HEAP_CAPACITY = new Type("Capacity", Generation.TENURED, Concurrency.SERIAL, GcPattern.GC_HEAP_MEMORY_PERCENTAGE);

// IBM Types
// TODO: are scavenge always young only??
public static final Type IBM_AF = new Type("af", Generation.YOUNG);
Expand Down Expand Up @@ -686,20 +737,24 @@ public enum GcPattern {
/** "GC type": "memory current"("memory total") */
GC_MEMORY,
/** "GC type": "memory before"-&gt;"memory after"("memory total"), "pause" */
GC_MEMORY_PAUSE,
GC_MEMORY_PAUSE,
/** "GC type": "# regions before"-&gt;"# regions after"[("#total regions")] ("total regions" is optional; needs a region size to calculate memory usage)*/
GC_REGION,
/** "Garbage Collection (Reason)" "memory before"("percentage of total")-&gt;"memory after"("percentage of total") */
GC_MEMORY_PERCENTAGE,
/** "Heap memory type" "memory current"("memory percentage") */
GC_HEAP_MEMORY_PERCENTAGE
}

public enum Concurrency { CONCURRENT, SERIAL };
public enum Concurrency { CONCURRENT, SERIAL }

public enum Generation { YOUNG,
TENURED,
/** also used for "metaspace" that is introduced with java 8 */
PERM,
ALL,
/** special value for vm operations that are not collections */
OTHER };
OTHER }

public enum CollectionType {
/** plain GC pause collection garbage */
Expand All @@ -712,5 +767,5 @@ public enum CollectionType {
*/
VM_OPERATION,
/** stop the world pause but used to prepare concurrent collection, might not collect garbage */
CONCURRENCY_HELPER };
CONCURRENCY_HELPER }
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,13 @@ public Generation getGeneration() {
return generation == null ? Generation.YOUNG : generation;
}

@Override
public void addPhase(AbstractGCEvent<?> phase) {
super.addPhase(phase);

// If it is a stop-the-world event, increase pause time for parent GC event
if (Concurrency.SERIAL.equals(phase.getExtendedType().getConcurrency())) {
setPause(getPause() + phase.getPause());
}
}
}
Loading

0 comments on commit 01fa608

Please sign in to comment.