diff --git a/api/src/main/java/com/microsoft/gctoolkit/event/zgc/OccupancySummary.java b/api/src/main/java/com/microsoft/gctoolkit/event/zgc/OccupancySummary.java deleted file mode 100644 index 6b0932ef..00000000 --- a/api/src/main/java/com/microsoft/gctoolkit/event/zgc/OccupancySummary.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -package com.microsoft.gctoolkit.event.zgc; - -public class OccupancySummary { - private final long markStart; - private final long markEnd; - private final long reclaimStart; - private final long reclaimEnd; - - public OccupancySummary(long markStart, long markEnd, long reclaimStart, long reclaimEnd) { - this.markStart = markStart; - this.markEnd = markEnd; - this.reclaimStart = reclaimStart; - this.reclaimEnd = reclaimEnd; - } - - public long getMarkEnd() { - return markEnd; - } - - public long getReclaimStart() { - return reclaimStart; - } - - public long getReclaimEnd() { - return reclaimEnd; - } - - public long getMarkStart() { - return markStart; - } - - public OccupancySummary sum(OccupancySummary other) { - if (other == null) { - return this; - } - return new OccupancySummary(markStart + other.markStart, markEnd + other.markEnd, reclaimStart + other.reclaimStart, reclaimEnd + other.reclaimEnd); - } -} diff --git a/api/src/main/java/com/microsoft/gctoolkit/event/zgc/ZGCCollection.java b/api/src/main/java/com/microsoft/gctoolkit/event/zgc/ZGCCollection.java index e14e959b..8938a7ca 100644 --- a/api/src/main/java/com/microsoft/gctoolkit/event/zgc/ZGCCollection.java +++ b/api/src/main/java/com/microsoft/gctoolkit/event/zgc/ZGCCollection.java @@ -23,7 +23,7 @@ public class ZGCCollection extends GCEvent { private ZGCCompactedSummary compactedSummary; private ZGCCycleType type; private ZGCPhase phase; - private OccupancySummary generationUsedSummary; + private ZGCUsedSummary usedSummary; private long gcId; private DateTimeStamp pauseMarkStartTimeStamp; private double pauseMarkStartDuration; @@ -59,7 +59,7 @@ public class ZGCCollection extends GCEvent { private ZGCLiveSummary liveSummary; private ZGCAllocatedSummary allocatedSummary; private ZGCGarbageSummary garbageSummary; - private ZGCReclaimSummary reclaimSummary; + private ZGCReclaimedSummary reclaimedSummary; private ZGCMemorySummary memorySummary; private ZGCMetaspaceSummary metaspaceSummary; private ZGCHeapCapacitySummary heapCapacitySummary; @@ -304,12 +304,12 @@ public void setGarbageSummary(ZGCGarbageSummary summary) { this.garbageSummary = summary; } - public ZGCReclaimSummary getReclaimSummary() { - return reclaimSummary; + public ZGCReclaimedSummary getReclaimedSummary() { + return reclaimedSummary; } - public void setReclaimSummary(ZGCReclaimSummary summary) { - this.reclaimSummary = summary; + public void setReclaimedSummary(ZGCReclaimedSummary summary) { + this.reclaimedSummary = summary; } public ZGCMemorySummary getMemorySummary() { @@ -416,13 +416,13 @@ public void setCompactedSummary(ZGCCompactedSummary compactedSummary) { this.compactedSummary = compactedSummary; } - public void setGenerationUsedSummary(OccupancySummary usedOccupancySummary) { + public void setUsedSummary(ZGCUsedSummary usedZGCUsedSummary) { - this.generationUsedSummary = usedOccupancySummary; + this.usedSummary = usedZGCUsedSummary; } - public OccupancySummary getGenerationUsedSummary() { - return generationUsedSummary; + public ZGCUsedSummary getUsedSummary() { + return usedSummary; } public ZGCCycleType getType() { diff --git a/api/src/main/java/com/microsoft/gctoolkit/event/zgc/ZGCReclaimSummary.java b/api/src/main/java/com/microsoft/gctoolkit/event/zgc/ZGCReclaimSummary.java deleted file mode 100644 index 30ea5d4a..00000000 --- a/api/src/main/java/com/microsoft/gctoolkit/event/zgc/ZGCReclaimSummary.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. -package com.microsoft.gctoolkit.event.zgc; - -public class ZGCReclaimSummary { - - private final long reclaimStart; - private final long reclaimEnd; - - public ZGCReclaimSummary(long reclaimStart, long reclaimEnd) { - this.reclaimStart = reclaimStart; - this.reclaimEnd = reclaimEnd; - } - - public long getReclaimStart() { - return reclaimStart; - } - - public long getReclaimEnd() { - return reclaimEnd; - } - - public ZGCReclaimSummary sum(ZGCReclaimSummary other) { - if (other == null) { - return this; - } - return new ZGCReclaimSummary(reclaimStart + other.reclaimStart, reclaimEnd + other.reclaimEnd); - } - -} diff --git a/api/src/main/java/com/microsoft/gctoolkit/event/zgc/ZGCReclaimedSummary.java b/api/src/main/java/com/microsoft/gctoolkit/event/zgc/ZGCReclaimedSummary.java new file mode 100644 index 00000000..3e8462c7 --- /dev/null +++ b/api/src/main/java/com/microsoft/gctoolkit/event/zgc/ZGCReclaimedSummary.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +package com.microsoft.gctoolkit.event.zgc; + +public class ZGCReclaimedSummary { + + private final long relocateStart; + private final long relocateEnd; + + public ZGCReclaimedSummary(long reclaimStart, long relocateEnd) { + this.relocateStart = reclaimStart; + this.relocateEnd = relocateEnd; + } + + public long getRelocateStart() { + return relocateStart; + } + + public long getRelocateEnd() { + return relocateEnd; + } + + public ZGCReclaimedSummary sum(ZGCReclaimedSummary other) { + if (other == null) { + return this; + } + return new ZGCReclaimedSummary(relocateStart + other.relocateStart, relocateEnd + other.relocateEnd); + } + +} diff --git a/api/src/main/java/com/microsoft/gctoolkit/event/zgc/ZGCUsedSummary.java b/api/src/main/java/com/microsoft/gctoolkit/event/zgc/ZGCUsedSummary.java new file mode 100644 index 00000000..52de2d97 --- /dev/null +++ b/api/src/main/java/com/microsoft/gctoolkit/event/zgc/ZGCUsedSummary.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +package com.microsoft.gctoolkit.event.zgc; + +public class ZGCUsedSummary { + private final long markStart; + private final long markEnd; + private final long relocateStart; + private final long relocateEnd; + + public ZGCUsedSummary(long markStart, long markEnd, long relocateStart, long reclaimEnd) { + this.markStart = markStart; + this.markEnd = markEnd; + this.relocateStart = relocateStart; + this.relocateEnd = reclaimEnd; + } + + public long getMarkEnd() { + return markEnd; + } + + public long getRelocateStart() { + return relocateStart; + } + + public long getRelocateEnd() { + return relocateEnd; + } + + public long getMarkStart() { + return markStart; + } + + public ZGCUsedSummary sum(ZGCUsedSummary other) { + if (other == null) { + return this; + } + return new ZGCUsedSummary(markStart + other.markStart, markEnd + other.markEnd, relocateStart + other.relocateStart, relocateEnd + other.relocateEnd); + } +} diff --git a/parser/src/main/java/com/microsoft/gctoolkit/parser/ZGCParser.java b/parser/src/main/java/com/microsoft/gctoolkit/parser/ZGCParser.java index 430adfb3..395da1ef 100644 --- a/parser/src/main/java/com/microsoft/gctoolkit/parser/ZGCParser.java +++ b/parser/src/main/java/com/microsoft/gctoolkit/parser/ZGCParser.java @@ -14,7 +14,7 @@ import com.microsoft.gctoolkit.event.zgc.ZGCGarbageSummary; import com.microsoft.gctoolkit.event.zgc.ZGCHeapCapacitySummary; import com.microsoft.gctoolkit.event.zgc.ZGCLiveSummary; -import com.microsoft.gctoolkit.event.zgc.OccupancySummary; +import com.microsoft.gctoolkit.event.zgc.ZGCUsedSummary; import com.microsoft.gctoolkit.event.zgc.ZGCCompactedSummary; import com.microsoft.gctoolkit.event.zgc.ZGCFullCollection; import com.microsoft.gctoolkit.event.zgc.ZGCYoungCollection; @@ -23,7 +23,7 @@ import com.microsoft.gctoolkit.event.zgc.ZGCPageSummary; import com.microsoft.gctoolkit.event.zgc.ZGCPhase; import com.microsoft.gctoolkit.event.zgc.ZGCPromotedSummary; -import com.microsoft.gctoolkit.event.zgc.ZGCReclaimSummary; +import com.microsoft.gctoolkit.event.zgc.ZGCReclaimedSummary; import com.microsoft.gctoolkit.event.zgc.ZGCCycleType; import com.microsoft.gctoolkit.event.zgc.ZGCCollection; import com.microsoft.gctoolkit.event.zgc.ZGCMarkSummary; @@ -463,12 +463,12 @@ private void sizeEntry(GCLogTrace trace, String s) { if (genHeapStats) { if ("Used".equals(trace.getGroup(2))){ - OccupancySummary summary = new OccupancySummary( + ZGCUsedSummary summary = new ZGCUsedSummary( trace.toKBytes(3), trace.toKBytes(6), trace.toKBytes(9), trace.toKBytes(12)); - ref.setGenerationUsedSummary(phase, summary); + ref.setUsedSummary(phase, summary); } else { trace.notYetImplemented(); } @@ -520,8 +520,8 @@ private void reclaimedPromoted(GCLogTrace trace, String s) { ZGCForwardReference ref = getForwardRefForPhase(trace.getZCollectionPhase()); if ("Reclaimed".equals(trace.getGroup(2))) { - ref.setReclaimSummary( - new ZGCReclaimSummary( + ref.setReclaimedSummary( + new ZGCReclaimedSummary( trace.toKBytes(3), trace.toKBytes(6) ) @@ -711,7 +711,7 @@ private static class ZGCForwardReference { private ZGCLiveSummary liveSummary; private ZGCAllocatedSummary allocatedSummary; private ZGCGarbageSummary garbageSummary; - private ZGCReclaimSummary reclaimSummary; + private ZGCReclaimedSummary reclaimedSummary; private ZGCMemorySummary memorySummary; private ZGCMetaspaceSummary metaspaceSummary; private ZGCMarkSummary markSummary; @@ -734,7 +734,7 @@ private static class ZGCForwardReference { private ZGCPromotedSummary promotedSummary; private ZGCCompactedSummary compactedSummary; private Double gcDuration; - private OccupancySummary generationUsedSummary; + private ZGCUsedSummary usedSummary; private ZGCReferenceSummary softRefSummary; private ZGCReferenceSummary weakRefSummary; private ZGCReferenceSummary finalRefSummary; @@ -798,7 +798,7 @@ public GCEvent getGCEVent(DateTimeStamp endTime) { cycle.setConcurrentRemapRoots(concurrentRemapRootsStart, concurrentRemapRootsDuration); cycle.setPromotedSummary(promotedSummary); cycle.setCompactedSummary(compactedSummary); - cycle.setGenerationUsedSummary(generationUsedSummary); + cycle.setUsedSummary(usedSummary); cycle.setSoftRefSummary(softRefSummary); cycle.setWeakRefSummary(weakRefSummary); cycle.setFinalRefSummary(finalRefSummary); @@ -813,7 +813,7 @@ public GCEvent getGCEVent(DateTimeStamp endTime) { cycle.setLiveSummary(liveSummary); cycle.setAllocatedSummary(allocatedSummary); cycle.setGarbageSummary(garbageSummary); - cycle.setReclaimSummary(reclaimSummary); + cycle.setReclaimedSummary(reclaimedSummary); cycle.setMemorySummary(memorySummary); cycle.setMetaspaceSummary(metaspaceSummary); cycle.setLoadAverages(load); @@ -928,8 +928,8 @@ public void setGarbageSummary(ZGCGarbageSummary summary) { this.garbageSummary = summary; } - public void setReclaimSummary(ZGCReclaimSummary summary) { - reclaimSummary = summary; + public void setReclaimedSummary(ZGCReclaimedSummary summary) { + reclaimedSummary = summary; } public void setMemorySummary(ZGCMemorySummary summary) { @@ -1034,7 +1034,7 @@ public void setGcDuration(double gcDuration) { this.gcDuration = gcDuration; } - public void setGenerationUsedSummary(ZGCPhase phase, OccupancySummary summary) { + public void setUsedSummary(ZGCPhase phase, ZGCUsedSummary summary) { switch (phase) { case FULL: // does not apply to non generational GC @@ -1042,7 +1042,7 @@ public void setGenerationUsedSummary(ZGCPhase phase, OccupancySummary summary) { case MAJOR_YOUNG: case MAJOR_OLD: case MINOR_YOUNG: - this.generationUsedSummary = summary; + this.usedSummary = summary; break; } } diff --git a/parser/src/test/java/com/microsoft/gctoolkit/parser/GenerationalZGCParserTest.java b/parser/src/test/java/com/microsoft/gctoolkit/parser/GenerationalZGCParserTest.java index 1cd36d8d..9d036b8d 100644 --- a/parser/src/test/java/com/microsoft/gctoolkit/parser/GenerationalZGCParserTest.java +++ b/parser/src/test/java/com/microsoft/gctoolkit/parser/GenerationalZGCParserTest.java @@ -166,12 +166,12 @@ public void testZgcMajorCycle() { assertTrue(checkZGCMetaSpaceSummary(young.getMetaspaceSummary(),36, 37, 1088)); - assertTrue(checkUsedSummary(young.getGenerationUsedSummary(), 296, 308, 240, 76)); + assertTrue(checkUsedSummary(young.getUsedSummary(), 296, 308, 240, 76)); assertTrue(checkLiveSummary(young.getLiveSummary(), 24, 24, 24)); assertTrue(checkGarbageSummary(young.getGarbageSummary(), 271, 203, 31)); assertTrue(checkAllocatedSummary(young.getAllocatedSummary(), 12, 12, 19)); - assertTrue(checkReclaimSummary(young.getReclaimSummary(), 68, 239)); + assertTrue(checkReclaimSummary(young.getReclaimedSummary(), 68, 239)); assertTrue(checkPromotedSummary(young.getPromotedSummary(), 0, 0)); assertTrue(checkCompactedSummary(young.getCompactedSummary(), 10)); @@ -253,12 +253,12 @@ public void testZgcMajorCycle() { assertEquals(125 * 1024, old.getForwardingUsage()); - assertTrue(checkUsedSummary(old.getGenerationUsedSummary(), 0, 0, 0, 0)); + assertTrue(checkUsedSummary(old.getUsedSummary(), 0, 0, 0, 0)); assertTrue(checkLiveSummary(old.getLiveSummary(), 0, 0, 0)); assertTrue(checkGarbageSummary(old.getGarbageSummary(), 0, 0, 0)); assertTrue(checkAllocatedSummary(old.getAllocatedSummary(), 0, 0, 0)); - assertTrue(checkReclaimSummary(old.getReclaimSummary(), 0, 0)); + assertTrue(checkReclaimSummary(old.getReclaimedSummary(), 0, 0)); assertNull(old.getPromotedSummary()); assertTrue(checkCompactedSummary(old.getCompactedSummary(), 0)); @@ -375,12 +375,12 @@ public void testZgcMinorCycle() { assertTrue(checkZGCMetaSpaceSummary(young.getMetaspaceSummary(),100, 101, 1152)); - assertTrue(checkUsedSummary(young.getGenerationUsedSummary(), 14132, 14900, 12364, 1466)); + assertTrue(checkUsedSummary(young.getUsedSummary(), 14132, 14900, 12364, 1466)); assertTrue(checkLiveSummary(young.getLiveSummary(), 120, 120, 120)); assertTrue(checkGarbageSummary(young.getGarbageSummary(), 14011, 11457, 2)); assertTrue(checkAllocatedSummary(young.getAllocatedSummary(), 768, 786, 1343)); - assertTrue(checkReclaimSummary(young.getReclaimSummary(), 2554, 14009)); + assertTrue(checkReclaimSummary(young.getReclaimedSummary(), 2554, 14009)); assertTrue(checkPromotedSummary(young.getPromotedSummary(), 0, 0)); assertTrue(checkCompactedSummary(young.getCompactedSummary(), 104)); @@ -638,8 +638,8 @@ private boolean checkReferenceSummary(ZGCReferenceSummary refSummary, long encou return refSummary.getEncountered() == encounderted && refSummary.getDiscovered() == discovered && refSummary.getEnqueued() == enqueued; } - private boolean checkUsedSummary(OccupancySummary summary, long markStart, long markEnd, long relocateStart, long relocateEnd) { - return summary.getMarkStart() == (markStart * 1024) && summary.getMarkEnd() == (markEnd * 1024) && summary.getReclaimStart() == (relocateStart * 1024) && summary.getReclaimEnd() == (relocateEnd * 1024); + private boolean checkUsedSummary(ZGCUsedSummary summary, long markStart, long markEnd, long relocateStart, long relocateEnd) { + return summary.getMarkStart() == (markStart * 1024) && summary.getMarkEnd() == (markEnd * 1024) && summary.getRelocateStart() == (relocateStart * 1024) && summary.getRelocateEnd() == (relocateEnd * 1024); } private boolean checkDateTimeStampMatch(String expected, double offsetMs, DateTimeStamp dateTimeStamp) { @@ -687,8 +687,8 @@ private boolean checkGarbageSummary(ZGCGarbageSummary summary, long markEnd, lon return summary.getMarkEnd() == (markEnd * 1024) && summary.getRelocateStart() == (relocateStart * 1024) && summary.getRelocateEnd() == (relocateEnd * 1024); } - private boolean checkReclaimSummary(ZGCReclaimSummary summary, long relocateStart, long relocateEnd) { - return summary.getReclaimStart() == (relocateStart * 1024) && summary.getReclaimEnd() == (relocateEnd * 1024); + private boolean checkReclaimSummary(ZGCReclaimedSummary summary, long relocateStart, long relocateEnd) { + return summary.getRelocateStart() == (relocateStart * 1024) && summary.getRelocateEnd() == (relocateEnd * 1024); } private boolean checkPromotedSummary(ZGCPromotedSummary summary, long relocateStart, long relocateEnd) { diff --git a/parser/src/test/java/com/microsoft/gctoolkit/parser/ZGCParserTest.java b/parser/src/test/java/com/microsoft/gctoolkit/parser/ZGCParserTest.java index 8011de88..0e26cf67 100644 --- a/parser/src/test/java/com/microsoft/gctoolkit/parser/ZGCParserTest.java +++ b/parser/src/test/java/com/microsoft/gctoolkit/parser/ZGCParserTest.java @@ -13,7 +13,7 @@ import com.microsoft.gctoolkit.event.zgc.ZGCMetaspaceSummary; import com.microsoft.gctoolkit.event.zgc.ZGCOldCollection; import com.microsoft.gctoolkit.event.zgc.ZGCPhase; -import com.microsoft.gctoolkit.event.zgc.ZGCReclaimSummary; +import com.microsoft.gctoolkit.event.zgc.ZGCReclaimedSummary; import com.microsoft.gctoolkit.event.zgc.ZGCYoungCollection; import com.microsoft.gctoolkit.jvm.Diarizer; import com.microsoft.gctoolkit.parser.jvm.UnifiedDiarizer; @@ -123,7 +123,7 @@ public void infoLevelZGCCycle() { assertTrue(checkAllocatedSummary(zgc.getAllocatedSummary(), 18432, 20480, 18432)); assertTrue(checkGarbageSummary(zgc.getGarbageSummary(), 497664, 456704, 35840)); - assertTrue(checkReclaimSummary(zgc.getReclaimSummary(), 40960, 460800)); + assertTrue(checkReclaimSummary(zgc.getReclaimedSummary(), 40960, 460800)); assertTrue(checkMemorySummary(zgc.getMemorySummary(), 571392, 129024)); assertEquals(7.28, zgc.getLoadAverageAt(1)); @@ -419,8 +419,8 @@ private boolean checkGarbageSummary(ZGCGarbageSummary summary, long markEnd, lon return summary.getMarkEnd() == markEnd && summary.getRelocateStart() == relocateStart && summary.getRelocateEnd() == relocateEnd; } - private boolean checkReclaimSummary(ZGCReclaimSummary summary, long relocateStart, long relocateEnd) { - return summary.getReclaimStart() == relocateStart && summary.getReclaimEnd() == relocateEnd; + private boolean checkReclaimSummary(ZGCReclaimedSummary summary, long relocateStart, long relocateEnd) { + return summary.getRelocateStart() == relocateStart && summary.getRelocateEnd() == relocateEnd; } private boolean checkMemorySummary(ZGCMemorySummary summary, long relocateStart, long relocateEnd) {