diff --git a/src/main/java/com/tagtraum/perf/gcviewer/imp/DataReaderFactory.java b/src/main/java/com/tagtraum/perf/gcviewer/imp/DataReaderFactory.java index 2b1b47ed..263f1bc4 100644 --- a/src/main/java/com/tagtraum/perf/gcviewer/imp/DataReaderFactory.java +++ b/src/main/java/com/tagtraum/perf/gcviewer/imp/DataReaderFactory.java @@ -157,13 +157,19 @@ else if (s.contains("][gc")) { if (getLogger().isLoggable(Level.INFO)) getLogger().info("File format: Oracle / OpenJDK unified jvm logging"); return new DataReaderUnifiedJvmLogging(gcResource, in); } - else if (s.contains(" (young)") || s.contains("G1Ergonomics") || s.contains(" (mixed)")) { + else if (s.contains(" (young)") || s.contains("G1Ergonomics") || s.contains(" (mixed)") || s.contains("-XX:+UseG1GC")) { // G1 logger usually starts with ": [GC pause (young)...]" // but can start with : [G1Ergonomics (Heap Sizing) expand the heap... // with certain logging flaggs. if (getLogger().isLoggable(Level.INFO)) getLogger().info("File format: Sun 1.6.x .. 1.8.x G1 collector"); return new DataReaderSun1_6_0G1(gcResource, in, GcLogType.SUN1_6G1); } + else if (s.contains("-XX:+UseSerialGC") || s.contains("-XX:+UseParallelGC") || s.contains("-XX:+UseConcMarkSweepGC") + || s.contains("-XX:+UseShenandoahGC")) { + + if (getLogger().isLoggable(Level.INFO)) getLogger().info("File format: Sun 1.6.x .. 1.8.x"); + return new DataReaderSun1_6_0(gcResource, in, GcLogType.SUN1_6); + } else if (s.contains("[Times:") || s.contains("[Pause Init Mark") /* Shenandoah, -XX:-PrintGCDetails */) { // all 1.6 lines end with a block like this "[Times: user=1.13 sys=0.08, real=0.95 secs]" if (getLogger().isLoggable(Level.INFO)) getLogger().info("File format: Sun 1.6.x"); diff --git a/src/test/java/com/tagtraum/perf/gcviewer/imp/TestDataReaderFactory.java b/src/test/java/com/tagtraum/perf/gcviewer/imp/TestDataReaderFactory.java index 08ea7077..8e082ddb 100644 --- a/src/test/java/com/tagtraum/perf/gcviewer/imp/TestDataReaderFactory.java +++ b/src/test/java/com/tagtraum/perf/gcviewer/imp/TestDataReaderFactory.java @@ -323,6 +323,17 @@ public void testOracleG1J8() throws Exception { assertDataReader(DataReaderSun1_6_0G1.class, dr.getClass()); } + @Test + public void testOracleG1J8ApplicationThreadsStopped() throws Exception { + // logs with -XX:+PrintGCApplicationStoppedTime often start with a lot of "Total time for which ..." lines + DataReaderFactory factory = new DataReaderFactory(); + 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" + + "Memory: 4k page, physical 50331128k(13997304k free), swap 60569268k(13009848k free)\n" + + "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" + + "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())); + assertDataReader(DataReaderSun1_6_0G1.class, dr.getClass()); + } + @Test public void testOracleG1J8_StringDeduplication() throws Exception { DataReaderFactory factory = new DataReaderFactory();