Skip to content

Commit 0df38d5

Browse files
authored
[ZGC] Add support for heap capacity, nMethod and relocation summary (#426)
* [zgc] Add support for heap capacity summary Adds support for heap capacity summary. Adds fixes to ensure that temporary long[]'s and booleans are reset between phases to ensure no data is carried over between cycles. * [zgc] Add support for nMethod tracking Adds support for nMethod tracking in generational ZGC young and old generations. * [zgc] Add support for relocation summary This commit adds support for all the information for gc,reloc stats. This includes Small, Medium and Large page stats, bytes forward and the age table for all the pages, including Eden and Survivor generations. The Small, Medium and Large table stats are directly accessible on the ZGC cycle, where the page age summaries for Eden and all Survivor generations are included as a variable sized list. As far as I can tell this list can be as long at 14.
1 parent 8d2281a commit 0df38d5

File tree

9 files changed

+483
-5
lines changed

9 files changed

+483
-5
lines changed

api/src/main/java/com/microsoft/gctoolkit/event/zgc/FullZGCCycle.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
import com.microsoft.gctoolkit.event.GarbageCollectionTypes;
88
import com.microsoft.gctoolkit.time.DateTimeStamp;
99

10+
import java.util.List;
11+
1012
public class FullZGCCycle extends GCEvent {
1113
private ZGCCycle delegate;
1214

@@ -250,6 +252,34 @@ public double getMarkFollowDuration() {
250252
public ZGCMemoryPoolSummary getRelocateEnd() {
251253
return delegate.getRelocateEnd();
252254
}
255+
256+
public ZGCHeapCapacitySummary getHeapCapacitySummary() {
257+
return delegate.getHeapCapacitySummary();
258+
}
259+
260+
public ZGCNMethodSummary getNMethodSummary() {
261+
return delegate.getNMethodSummary();
262+
}
263+
264+
public ZGCPageSummary getSmallPageSummary() {
265+
return delegate.getSmallPageSummary();
266+
}
267+
268+
public ZGCPageSummary getMediumPageSummary() {
269+
return delegate.getMediumPageSummary();
270+
}
271+
272+
public ZGCPageSummary getLargePageSummary() {
273+
return delegate.getLargePageSummary();
274+
}
275+
276+
public long getForwardingUsage() {
277+
return delegate.getForwardingUsage();
278+
}
279+
280+
public List<ZGCPageAgeSummary> getAgeTableSummary() {
281+
return delegate.getAgeTableSummary();
282+
}
253283
}
254284

255285
// Concurrent Mark duration

api/src/main/java/com/microsoft/gctoolkit/event/zgc/ZGCCycle.java

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import com.microsoft.gctoolkit.time.DateTimeStamp;
44

5+
import java.util.List;
6+
57
public class ZGCCycle {
68
private DateTimeStamp markRootsStart;
79
private double markRootsDuration;
@@ -57,6 +59,14 @@ public class ZGCCycle {
5759
private ZGCReclaimSummary reclaimSummary;
5860
private ZGCMemorySummary memorySummary;
5961
private ZGCMetaspaceSummary metaspaceSummary;
62+
private ZGCHeapCapacitySummary heapCapacitySummary;
63+
private ZGCNMethodSummary nMethodSummary;
64+
65+
private ZGCPageSummary smallPageSummary;
66+
private ZGCPageSummary mediumPageSummary;
67+
private ZGCPageSummary largePageSummary;
68+
private long forwardingUsage;
69+
private List<ZGCPageAgeSummary> ageTableSummary;
6070

6171
public ZGCReferenceSummary getSoftRefSummary() {
6272
return softRefSummary;
@@ -493,4 +503,60 @@ public void setFinalRefSummary(ZGCReferenceSummary finalRefSummary) {
493503
public void setPhantomRefSummary(ZGCReferenceSummary phantomRefSummary) {
494504
this.phantomRefSummary = phantomRefSummary;
495505
}
506+
507+
public void setHeapCapacitySummary(ZGCHeapCapacitySummary heapCapacitySummary) {
508+
this.heapCapacitySummary = heapCapacitySummary;
509+
}
510+
511+
public ZGCHeapCapacitySummary getHeapCapacitySummary() {
512+
return heapCapacitySummary;
513+
}
514+
515+
public void setNMethodSummary(ZGCNMethodSummary nMethodSummary) {
516+
this.nMethodSummary = nMethodSummary;
517+
}
518+
519+
public ZGCNMethodSummary getNMethodSummary() {
520+
return nMethodSummary;
521+
}
522+
523+
public void setSmallPageSummary(ZGCPageSummary smallPageSummary) {
524+
this.smallPageSummary = smallPageSummary;
525+
}
526+
527+
public void setMediumPageSummary(ZGCPageSummary mediumPageSummary) {
528+
this.mediumPageSummary = mediumPageSummary;
529+
}
530+
531+
public void setLargePageSummary(ZGCPageSummary largePageSummary) {
532+
this.largePageSummary = largePageSummary;
533+
}
534+
535+
public ZGCPageSummary getSmallPageSummary() {
536+
return smallPageSummary;
537+
}
538+
539+
public ZGCPageSummary getMediumPageSummary() {
540+
return mediumPageSummary;
541+
}
542+
543+
public ZGCPageSummary getLargePageSummary() {
544+
return largePageSummary;
545+
}
546+
547+
public void setForwardingUsage(long forwardingUsage) {
548+
this.forwardingUsage = forwardingUsage;
549+
}
550+
551+
public long getForwardingUsage() {
552+
return forwardingUsage;
553+
}
554+
555+
public void setAgeTableSummary(List<ZGCPageAgeSummary> ageTableSummary) {
556+
this.ageTableSummary = ageTableSummary;
557+
}
558+
559+
public List<ZGCPageAgeSummary> getAgeTableSummary() {
560+
return ageTableSummary;
561+
}
496562
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.microsoft.gctoolkit.event.zgc;
2+
3+
public class ZGCHeapCapacitySummary {
4+
private final long minCapacity;
5+
private final long maxCapacity;
6+
private final long softMaxCapacity;
7+
8+
public ZGCHeapCapacitySummary(long minCapacity, long maxCapacity, long softMaxCapacity) {
9+
this.minCapacity = minCapacity;
10+
this.maxCapacity = maxCapacity;
11+
this.softMaxCapacity = softMaxCapacity;
12+
}
13+
14+
public long getMinCapacity() {
15+
return minCapacity;
16+
}
17+
18+
public long getMaxCapacity() {
19+
return maxCapacity;
20+
}
21+
22+
public long getSoftMaxCapacity() {
23+
return softMaxCapacity;
24+
}
25+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.microsoft.gctoolkit.event.zgc;
2+
3+
public class ZGCNMethodSummary {
4+
private final long registered;
5+
private final long unregistered;
6+
7+
public ZGCNMethodSummary(long registered, long unregistered) {
8+
this.registered = registered;
9+
this.unregistered = unregistered;
10+
}
11+
12+
public long getUnregistered() {
13+
return unregistered;
14+
}
15+
16+
public long getRegistered() {
17+
return registered;
18+
}
19+
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
package com.microsoft.gctoolkit.event.zgc;
2+
3+
public class ZGCPageAgeSummary {
4+
private final String name;
5+
private final long live;
6+
private final int livePct;
7+
private final long garbage;
8+
private final int garbagePct;
9+
private final long smallPageCandidates;
10+
private final long smallPageSelected;
11+
private final long mediumPageCandidates;
12+
private final long mediumPageSelected;
13+
private final long largePageCandidates;
14+
private final long largePageSelected;
15+
16+
public ZGCPageAgeSummary(
17+
String name,
18+
long live,
19+
int livePct,
20+
long garbage,
21+
int garbagePct,
22+
long smallPageCandidates,
23+
long smallPageSelected,
24+
long mediumPageCandidates,
25+
long mediumPageSelected,
26+
long largePageCandidates,
27+
long largePageSelected) {
28+
this.name = name;
29+
this.live = live;
30+
this.livePct = livePct;
31+
this.garbage = garbage;
32+
this.garbagePct = garbagePct;
33+
this.smallPageCandidates = smallPageCandidates;
34+
this.smallPageSelected = smallPageSelected;
35+
this.mediumPageCandidates = mediumPageCandidates;
36+
this.mediumPageSelected = mediumPageSelected;
37+
this.largePageCandidates = largePageCandidates;
38+
this.largePageSelected = largePageSelected;
39+
}
40+
41+
public long getGarbage() {
42+
return garbage;
43+
}
44+
45+
public int getGarbagePct() {
46+
return garbagePct;
47+
}
48+
49+
public long getLargePageCandidates() {
50+
return largePageCandidates;
51+
}
52+
53+
public long getLargePageSelected() {
54+
return largePageSelected;
55+
}
56+
57+
public long getLive() {
58+
return live;
59+
}
60+
61+
public int getLivePct() {
62+
return livePct;
63+
}
64+
65+
public long getMediumPageCandidates() {
66+
return mediumPageCandidates;
67+
}
68+
69+
public long getMediumPageSelected() {
70+
return mediumPageSelected;
71+
}
72+
73+
public String getName() {
74+
return name;
75+
}
76+
77+
public long getSmallPageCandidates() {
78+
return smallPageCandidates;
79+
}
80+
81+
public long getSmallPageSelected() {
82+
return smallPageSelected;
83+
}
84+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package com.microsoft.gctoolkit.event.zgc;
2+
3+
public class ZGCPageSummary {
4+
private final long candidates;
5+
private final long selected;
6+
private final long inPlace;
7+
private final long size;
8+
private final long empty;
9+
private final long relocated;
10+
11+
public ZGCPageSummary(long candidates, long selected, long inPlace, long size, long empty, long relocated) {
12+
this.candidates = candidates;
13+
this.selected = selected;
14+
this.inPlace = inPlace;
15+
this.size = size;
16+
this.empty = empty;
17+
this.relocated = relocated;
18+
}
19+
20+
public long getCandidates() {
21+
return candidates;
22+
}
23+
24+
public long getEmpty() {
25+
return empty;
26+
}
27+
28+
public long getInPlace() {
29+
return inPlace;
30+
}
31+
32+
public long getRelocated() {
33+
return relocated;
34+
}
35+
36+
public long getSelected() {
37+
return selected;
38+
}
39+
40+
public long getSize() {
41+
return size;
42+
}
43+
}

0 commit comments

Comments
 (0)