Skip to content

Commit ff09b5e

Browse files
committed
improve content analysis for DataReaders
1 parent e269fea commit ff09b5e

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,19 @@ else if (s.contains("][gc")) {
157157
if (getLogger().isLoggable(Level.INFO)) getLogger().info("File format: Oracle / OpenJDK unified jvm logging");
158158
return new DataReaderUnifiedJvmLogging(gcResource, in);
159159
}
160-
else if (s.contains(" (young)") || s.contains("G1Ergonomics") || s.contains(" (mixed)")) {
160+
else if (s.contains(" (young)") || s.contains("G1Ergonomics") || s.contains(" (mixed)") || s.contains("-XX:+UseG1GC")) {
161161
// G1 logger usually starts with "<timestamp>: [GC pause (young)...]"
162162
// but can start with <timestamp>: [G1Ergonomics (Heap Sizing) expand the heap...
163163
// with certain logging flaggs.
164164
if (getLogger().isLoggable(Level.INFO)) getLogger().info("File format: Sun 1.6.x .. 1.8.x G1 collector");
165165
return new DataReaderSun1_6_0G1(gcResource, in, GcLogType.SUN1_6G1);
166166
}
167+
else if (s.contains("-XX:+UseSerialGC") || s.contains("-XX:+UseParallelGC") || s.contains("-XX:+UseConcMarkSweepGC")
168+
|| s.contains("-XX:+UseShenandoahGC")) {
169+
170+
if (getLogger().isLoggable(Level.INFO)) getLogger().info("File format: Sun 1.6.x .. 1.8.x");
171+
return new DataReaderSun1_6_0(gcResource, in, GcLogType.SUN1_6);
172+
}
167173
else if (s.contains("[Times:") || s.contains("[Pause Init Mark") /* Shenandoah, -XX:-PrintGCDetails */) {
168174
// all 1.6 lines end with a block like this "[Times: user=1.13 sys=0.08, real=0.95 secs]"
169175
if (getLogger().isLoggable(Level.INFO)) getLogger().info("File format: Sun 1.6.x");

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,17 @@ public void testOracleG1J8() throws Exception {
323323
assertDataReader(DataReaderSun1_6_0G1.class, dr.getClass());
324324
}
325325

326+
@Test
327+
public void testOracleG1J8ApplicationThreadsStopped() throws Exception {
328+
// logs with -XX:+PrintGCApplicationStoppedTime often start with a lot of "Total time for which ..." lines
329+
DataReaderFactory factory = new DataReaderFactory();
330+
DataReader dr = factory.getDataReader(new GcResourceFile("byteArray"), new ByteArrayInputStream(("Java HotSpot(TM) 64-Bit Server VM (25.112-b15) for windows-amd64 JRE (1.8.0_112-b15), built on Sep 22 2016 21:31:56 by \"java_re\" with MS VC++ 10.0 (VS2010)\n" +
331+
"Memory: 4k page, physical 50331128k(13997304k free), swap 60569268k(13009848k free)\n" +
332+
"CommandLine flags: -XX:CICompilerCount=4 -XX:ConcGCThreads=3 -XX:G1HeapRegionSize=2097152 -XX:GCLogFileSize=1048576 -XX:InitialHeapSize=4294967296 -XX:+ManagementServer -XX:MarkStackSize=4194304 -XX:MaxHeapSize=8589934592 -XX:MaxNewSize=5152702464 -XX:MinHeapDeltaBytes=2097152 -XX:NumberOfGCLogFiles=5 -XX:-OmitStackTraceInFastThrow -XX:+ParallelRefProcEnabled -XX:+PrintGC -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintTenuringDistribution -XX:+ReduceSignalUsage -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseFastUnorderedTimeStamps -XX:+UseG1GC -XX:+UseGCLogFileRotation -XX:-UseLargePagesIndividualAllocation\n" +
333+
"2019-12-15T15:53:20.985+0100: 82113.171: Total time for which application threads were stopped: 0.0019721 seconds, Stopping threads took: 0.0001040 seconds\n\n").getBytes()));
334+
assertDataReader(DataReaderSun1_6_0G1.class, dr.getClass());
335+
}
336+
326337
@Test
327338
public void testOracleG1J8_StringDeduplication() throws Exception {
328339
DataReaderFactory factory = new DataReaderFactory();

0 commit comments

Comments
 (0)