Skip to content

Commit b7733e9

Browse files
author
Christian Mötzing
committed
Parse full gc for IBM J9
The tag concurrent-collection-start marks a full gc pase.
1 parent 1075435 commit b7733e9

File tree

3 files changed

+28
-24
lines changed

3 files changed

+28
-24
lines changed

src/main/java/com/tagtraum/perf/gcviewer/imp/DataReaderIBM_J9_R28.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ public GCModel read() throws IOException {
8282
assert eventNameStart == null : "eventNameStart was expected to be null, but was " + eventNameStart;
8383
eventNameStart = handleAfStart(eventReader, startElement);
8484
break;
85+
case CONCURRENT_COLLECTION_START:
86+
assert eventNameStart == null : "eventNameStart was expected to be null, but was " + eventNameStart;
87+
eventNameStart = handleConcurrentCollectionStart(eventReader, startElement);
88+
break;
8589
case GC_START:
8690
handleGcStart(eventReader, startElement, currentGcEvent, eventNameStart);
8791
break;
@@ -179,7 +183,8 @@ private String handleAfStart(XMLEventReader eventReader, StartElement startEleme
179183
return "af ";
180184
}
181185

182-
private void handleConcurrentCollectionStart(XMLEventReader eventReader, StartElement startElement) {
186+
private String handleConcurrentCollectionStart(XMLEventReader eventReader, StartElement startElement) {
187+
return "concurrent-collection-start ";
183188
}
184189

185190
private void handleGcStart(XMLEventReader eventReader, StartElement startElement, GCEvent event, String eventNameStart) throws
@@ -195,7 +200,7 @@ private void handleGcStart(XMLEventReader eventReader, StartElement startElement
195200

196201
String currentElementName = "";
197202
while (eventReader.hasNext() && !currentElementName.equals(GC_START)) {
198-
203+
199204
XMLEvent xmlEvent = eventReader.nextEvent();
200205
if (xmlEvent.isStartElement()) {
201206
StartElement startEl = xmlEvent.asStartElement();
@@ -230,7 +235,6 @@ else if (xmlEvent.isEndElement()) {
230235
private void handleGcEnd(XMLEventReader eventReader, GCEvent event) throws XMLStreamException {
231236
String currentElementName = "";
232237
while (eventReader.hasNext() && !currentElementName.equals(GC_END)) {
233-
234238
XMLEvent xmlEvent = eventReader.nextEvent();
235239
if (xmlEvent.isStartElement()) {
236240
StartElement startEl = xmlEvent.asStartElement();
@@ -273,11 +277,11 @@ private String getAttributeValue(StartElement event, String name) {
273277
if (attr != null) {
274278
value = attr.getValue();
275279
}
276-
280+
277281
return value;
278282
}
279283

280284
private int toKiloBytes(long bytes) {
281-
return (int)Math.rint(bytes / (double)1024);
285+
return (int) Math.rint(bytes / (double) 1024);
282286
}
283287
}

src/main/java/com/tagtraum/perf/gcviewer/model/AbstractGCEvent.java

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public Iterator<T> details() {
4646
public void add(T detail) {
4747
// most events have only one detail event
4848
if (details == null) {
49-
details = new ArrayList<T>(2);
49+
details = new ArrayList<T>(2);
5050
}
5151
details.add(detail);
5252
typeAsString += "; " + detail.getExtendedType().getName();
@@ -80,7 +80,7 @@ public void addPhase(AbstractGCEvent<?> phase) {
8080

8181
@Override
8282
protected Object clone() throws CloneNotSupportedException {
83-
AbstractGCEvent<T> clonedEvent = (AbstractGCEvent<T>)super.clone();
83+
AbstractGCEvent<T> clonedEvent = (AbstractGCEvent<T>) super.clone();
8484
if (getDatestamp() != null) {
8585
clonedEvent.setDateStamp(ZonedDateTime.from(this.getDatestamp()));
8686
}
@@ -90,7 +90,7 @@ protected Object clone() throws CloneNotSupportedException {
9090
if (details != null) {
9191
List<T> detailClones = new ArrayList<>();
9292
for (T t : details) {
93-
detailClones.add((T)t.clone());
93+
detailClones.add((T) t.clone());
9494
}
9595
clonedEvent.details = detailClones;
9696
}
@@ -102,7 +102,7 @@ protected Object clone() throws CloneNotSupportedException {
102102

103103
public AbstractGCEvent<T> cloneAndMerge(AbstractGCEvent<T> otherEvent) {
104104
try {
105-
AbstractGCEvent<T> clonedEvent = (AbstractGCEvent<T>)otherEvent.clone();
105+
AbstractGCEvent<T> clonedEvent = (AbstractGCEvent<T>) otherEvent.clone();
106106
clonedEvent.setExtendedType(new ExtendedType(getExtendedType().getType(), getExtendedType().fullName + "+" + clonedEvent.getExtendedType().fullName));
107107
clonedEvent.setPreUsed(clonedEvent.getPreUsed() + getPreUsed());
108108
clonedEvent.setPostUsed(clonedEvent.getPostUsed() + getPostUsed());
@@ -115,7 +115,7 @@ public AbstractGCEvent<T> cloneAndMerge(AbstractGCEvent<T> otherEvent) {
115115
}
116116

117117
public void setDateStamp(ZonedDateTime datestamp) {
118-
this.datestamp = datestamp;
118+
this.datestamp = datestamp;
119119
}
120120

121121
public void setNumber(int number) {
@@ -158,7 +158,7 @@ public int getNumber() {
158158
}
159159

160160
public String getTypeAsString() {
161-
return typeAsString;
161+
return typeAsString;
162162
}
163163

164164
public boolean isStopTheWorld() {
@@ -176,6 +176,7 @@ public boolean isStopTheWorld() {
176176

177177
/**
178178
* Returns the generation of the event including generation of detail events if present.
179+
*
179180
* @return generation of event including generation of detail events
180181
*/
181182
public Generation getGeneration() {
@@ -194,7 +195,7 @@ public Generation getGeneration() {
194195
generation = Generation.ALL;
195196
}
196197
else if (generationSet.size() == 1) {
197-
generation = generationSet.iterator().next();
198+
generation = generationSet.iterator().next();
198199
}
199200
else {
200201
// default
@@ -247,7 +248,7 @@ public int getTotal() {
247248
public abstract void toStringBuffer(StringBuffer sb);
248249

249250
@Override
250-
public String toString() {
251+
public String toString() {
251252
StringBuffer sb = new StringBuffer(128);
252253
toStringBuffer(sb);
253254
return sb.toString();
@@ -441,7 +442,7 @@ public int hashCode() {
441442
public String toString() {
442443
return fullName;
443444
}
444-
}
445+
}
445446

446447
/**
447448
* Representation of an event type
@@ -460,7 +461,7 @@ private Type(String name, Generation generation) {
460461
}
461462

462463
private Type(String name, Generation generation, Concurrency concurrency) {
463-
this(name, generation, concurrency, GcPattern.GC_MEMORY_PAUSE);
464+
this(name, generation, concurrency, GcPattern.GC_MEMORY_PAUSE);
464465
}
465466

466467
private Type(String name, Generation generation, Concurrency concurrency, GcPattern pattern) {
@@ -494,7 +495,7 @@ public Concurrency getConcurrency() {
494495
}
495496

496497
public GcPattern getPattern() {
497-
return pattern;
498+
return pattern;
498499
}
499500

500501
public CollectionType getCollectionType() {
@@ -544,11 +545,11 @@ public String toString() {
544545
public static final Type CMS_PERM = new Type("CMS Perm", Generation.PERM, Concurrency.SERIAL, GcPattern.GC_MEMORY);
545546

546547
// Parnew (promotion failed)
547-
public static final Type PAR_NEW_PROMOTION_FAILED = new Type("ParNew (promotion failed)", Generation.YOUNG, Concurrency.SERIAL);
548+
public static final Type PAR_NEW_PROMOTION_FAILED = new Type("ParNew (promotion failed)", Generation.YOUNG, Concurrency.SERIAL);
548549

549550
// CMS (concurrent mode failure / interrupted)
550-
public static final Type CMS_CMF = new Type("CMS (concurrent mode failure)", Generation.TENURED, Concurrency.SERIAL);
551-
public static final Type CMS_CMI = new Type("CMS (concurrent mode interrupted)", Generation.TENURED, Concurrency.SERIAL);
551+
public static final Type CMS_CMF = new Type("CMS (concurrent mode failure)", Generation.TENURED, Concurrency.SERIAL);
552+
public static final Type CMS_CMI = new Type("CMS (concurrent mode interrupted)", Generation.TENURED, Concurrency.SERIAL);
552553

553554
// CMS (Concurrent Mark Sweep) Event Types
554555
public static final Type CMS_CONCURRENT_MARK_START = new Type("CMS-concurrent-mark-start", Generation.TENURED, Concurrency.CONCURRENT, GcPattern.GC);
@@ -569,7 +570,7 @@ public String toString() {
569570
public static final Type ASCMS = new Type("ASCMS", Generation.TENURED);
570571

571572
// Parnew (promotion failed) AdaptiveSizePolicy
572-
public static final Type ASPAR_NEW_PROMOTION_FAILED = new Type("ASParNew (promotion failed)", Generation.YOUNG, Concurrency.SERIAL);
573+
public static final Type ASPAR_NEW_PROMOTION_FAILED = new Type("ASParNew (promotion failed)", Generation.YOUNG, Concurrency.SERIAL);
573574

574575
// CMS (concurrent mode failure / interrupted) AdaptiveSizePolicy
575576
public static final Type ASCMS_CMF = new Type("ASCMS (concurrent mode failure)", Generation.TENURED, Concurrency.SERIAL);
@@ -720,7 +721,7 @@ public String toString() {
720721
public static final Type IBM_NURSERY = new Type("nursery", Generation.YOUNG);
721722
public static final Type IBM_TENURE = new Type("tenure", Generation.TENURED);
722723

723-
public static final Type IBM_CONCURRENT_COLLECTION_START = new Type("concurrent-collection-start", Generation.ALL, Concurrency.CONCURRENT);
724+
public static final Type IBM_CONCURRENT_COLLECTION_START = new Type("concurrent-collection-start global", Generation.ALL, Concurrency.CONCURRENT);
724725

725726
}
726727

src/test/java/com/tagtraum/perf/gcviewer/imp/TestDataReaderIBM_J9_R28.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import com.tagtraum.perf.gcviewer.model.GCModel;
1717
import com.tagtraum.perf.gcviewer.model.GCResource;
1818
import com.tagtraum.perf.gcviewer.model.GcResourceFile;
19-
import org.junit.Ignore;
2019
import org.junit.Test;
2120

2221
/**
@@ -42,7 +41,7 @@ public void testAfScavenge() throws Exception {
4241

4342
DataReader reader = getDataReader(gcResource);
4443
GCModel model = reader.read();
45-
44+
4645
assertThat("model size", model.size(), is(2));
4746

4847
GCEvent event = (GCEvent) model.get(0);
@@ -121,7 +120,7 @@ public void testConcurrentMinimal() throws Exception {
121120
assertThat("number of errors", handler.getCount(), is(0));
122121
}
123122

124-
@Test @Ignore
123+
@Test
125124
public void testConcurrentCollection() throws Exception {
126125
TestLogHandler handler = new TestLogHandler();
127126
handler.setLevel(Level.WARNING);

0 commit comments

Comments
 (0)