зеркало из https://github.com/microsoft/gctoolkit.git
* improve archive region calculation (#211) * Add comment for Archive Region availability * Update parser/src/main/java/com/microsoft/gctoolkit/parser/UnifiedG1GCParser.java * Update parser/src/main/java/com/microsoft/gctoolkit/parser/UnifiedG1GCParser.java * Update parser/src/main/java/com/microsoft/gctoolkit/parser/UnifiedG1GCParser.java * Update parser/src/main/java/com/microsoft/gctoolkit/parser/UnifiedG1GCParser.java --------- Co-authored-by: Martijn Verburg <martijnverburg@gmail.com>
This commit is contained in:
Родитель
25a8f22bed
Коммит
aaeb875c7a
|
@ -29,6 +29,7 @@ public abstract class G1GCPauseEvent extends G1GCEvent {
|
|||
private RegionSummary archiveRegion;
|
||||
|
||||
private CPUSummary cpuSummary;
|
||||
private int heapRegionSize;
|
||||
|
||||
public G1GCPauseEvent(DateTimeStamp timeStamp, GarbageCollectionTypes type, GCCause cause, double duration) {
|
||||
super(timeStamp, type, cause, duration);
|
||||
|
@ -102,10 +103,15 @@ public abstract class G1GCPauseEvent extends G1GCEvent {
|
|||
} else if (getSurvivor() == null) {
|
||||
return getHeap().minus(getEden());
|
||||
} else {
|
||||
return new MemoryPoolSummary(getHeap().getOccupancyBeforeCollection() - this.getEden().getOccupancyBeforeCollection() - getSurvivor().getOccupancyBeforeCollection(),
|
||||
getHeap().getSizeBeforeCollection() - getEden().getSizeBeforeCollection() - getSurvivor().getOccupancyBeforeCollection(),
|
||||
getHeap().getOccupancyAfterCollection() - getEden().getOccupancyAfterCollection() - getSurvivor().getOccupancyAfterCollection(),
|
||||
getHeap().getSizeAfterCollection() - getEden().getSizeAfterCollection() - getSurvivor().getOccupancyAfterCollection());
|
||||
final RegionSummary summary = getArchiveRegionSummary();
|
||||
final long archiveRegionByteBefore = summary.getBefore() * heapRegionSize * 1024L;
|
||||
final long archiveRegionByteAfter = summary.getAfter() * heapRegionSize * 1024L;
|
||||
final long archiveRegionByteAssigned = summary.getAssigned() * heapRegionSize * 1024L;
|
||||
|
||||
return new MemoryPoolSummary(getHeap().getOccupancyBeforeCollection() - this.getEden().getOccupancyBeforeCollection() - getSurvivor().getOccupancyBeforeCollection() - archiveRegionByteAssigned,
|
||||
getHeap().getSizeBeforeCollection() - getEden().getSizeBeforeCollection() - getSurvivor().getOccupancyBeforeCollection() - archiveRegionByteBefore,
|
||||
getHeap().getOccupancyAfterCollection() - getEden().getOccupancyAfterCollection() - getSurvivor().getOccupancyAfterCollection() - archiveRegionByteAssigned,
|
||||
getHeap().getSizeAfterCollection() - getEden().getSizeAfterCollection() - getSurvivor().getOccupancyAfterCollection() - archiveRegionByteAfter);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,4 +127,7 @@ public abstract class G1GCPauseEvent extends G1GCEvent {
|
|||
return this.cpuSummary;
|
||||
}
|
||||
|
||||
public void addHeapRegionSize(int heapRegionSize) {
|
||||
this.heapRegionSize = heapRegionSize;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -544,6 +544,7 @@ class G1GCForwardReference extends ForwardReference {
|
|||
SurvivorMemoryPoolSummary survivor = getSurvivorMemoryPoolSummary();
|
||||
MemoryPoolSummary tenured = getMemoryPoolSummary(OLD_OCCUPANCY_BEFORE_COLLECTION);
|
||||
MemoryPoolSummary humongous = getMemoryPoolSummary(HUMONGOUS_OCCUPANCY_BEFORE_COLLECTION);
|
||||
collection.addHeapRegionSize(heapRegionSize);
|
||||
if (heap != null && eden != null && survivor != null) {
|
||||
collection.addMemorySummary(eden, survivor, heap);
|
||||
} else if (eden == null && survivor == null && heap != null) {
|
||||
|
|
|
@ -494,6 +494,7 @@ public class UnifiedG1GCParser extends UnifiedGCLogParser implements UnifiedG1GC
|
|||
forwardReference.setHumongousRegionSummary(summary);
|
||||
break;
|
||||
case "Archive":
|
||||
// Archive Region type is only available in JDK 14 and 17.
|
||||
forwardReference.setArchiveRegionSummary(summary);
|
||||
break;
|
||||
default:
|
||||
|
|
Загрузка…
Ссылка в новой задаче