in analysis/gc-log/src/main/java/org/eclipse/jifa/gclog/model/G1GCModel.java [166:214]
private void decideGCsAfterOldGC() {
GCEvent lastGCInCycle = null;
double lastRemarkEndTime = Double.MAX_VALUE;
double lastConcCycleEndTime = Double.MAX_VALUE;
for (GCEvent event : getGcEvents()) {
GCEventType type = event.getEventType();
if (type == G1_CONCURRENT_UNDO_CYCLE) {
continue;
}
if (type == G1_CONCURRENT_CYCLE) {
if (event.containPhase(G1_CONCURRENT_MARK_ABORT)) {
return;
}
lastConcCycleEndTime = event.getEndTime();
GCEvent remark = event.getLastPhaseOfType(G1_REMARK);
if (remark != null) {
lastRemarkEndTime = remark.getEndTime();
}
}
if (type == FULL_GC || type == YOUNG_GC || type == G1_MIXED_GC) {
if (event.getStartTime() > lastRemarkEndTime) {
event.setTrue(GCEventBooleanType.GC_AFTER_REMARK);
lastRemarkEndTime = Double.MAX_VALUE;
}
if (event.getStartTime() >= lastConcCycleEndTime) {
if (type == FULL_GC) {
// a full gc interrupts mixed gcs
event.setTrue(GC_AT_END_OF_OLD_CYCLE);
lastGCInCycle = null;
lastConcCycleEndTime = Double.MAX_VALUE;
} else if (lastGCInCycle == null) {
lastGCInCycle = event;
if (type == YOUNG_GC && getLogStyle() == GCLogStyle.PRE_UNIFIED) {
// jdk8 does not print Prepare Mixed, add this sign for easier
// future analysis
event.setTrue(GCEventBooleanType.PREPARE_MIXED);
}
} else if (type == YOUNG_GC) {
// we have found the end of mixed gcs
lastGCInCycle.setTrue(GC_AT_END_OF_OLD_CYCLE);
lastGCInCycle = null;
lastConcCycleEndTime = Double.MAX_VALUE;
} else if (type == G1_MIXED_GC) {
lastGCInCycle = event;
}
}
}
}
}