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 263f1bc4..8664d17d 100644 --- a/src/main/java/com/tagtraum/perf/gcviewer/imp/DataReaderFactory.java +++ b/src/main/java/com/tagtraum/perf/gcviewer/imp/DataReaderFactory.java @@ -161,18 +161,17 @@ else if (s.contains(" (young)") || s.contains("G1Ergonomics") || s.contains(" (m // 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"); + if (getLogger().isLoggable(Level.INFO)) getLogger().info("File format: Sun / Oracle / OpenJdk 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"); + else if (s.contains("CommandLine flags:")) { + // all OpenJdk logs with non G1 gc collector + if (getLogger().isLoggable(Level.INFO)) getLogger().info("File format: Oracle / OpenJdk 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"); + 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("CMS-initial-mark") || s.contains("PSYoungGen")) { 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 8e082ddb..9ea33971 100644 --- a/src/test/java/com/tagtraum/perf/gcviewer/imp/TestDataReaderFactory.java +++ b/src/test/java/com/tagtraum/perf/gcviewer/imp/TestDataReaderFactory.java @@ -313,6 +313,26 @@ public void testSun1_4_0() throws Exception { assertDataReader(DataReaderSun1_6_0.class, dr.getClass()); } + @Test + public void testOpenJdk8DockerMemory512mCpus0_5() throws IOException { + // Using an OpenJdk8 docker image and letting the JVM decide on the algorithm (--memory=512m --cpus="0.5") + DataReaderFactory factory = new DataReaderFactory(); + DataReader dr = factory.getDataReader(new GcResourceFile("byteArray"), new ByteArrayInputStream(("OpenJDK 64-Bit Server VM (25.275-b01) for linux-amd64 JRE (1.8.0_275-b01), built on Nov 6 2020 14:10:46 by \"openjdk\" with gcc 4.4.7 20120313 (Red Hat 4.4.7-23)\n" + + "Memory: 4k page, physical 524288k(521828k free), swap 1048572k(1048572k free)\n" + + "CommandLine flags: -XX:InitialHeapSize=8388608 -XX:MaxHeapSize=134217728 -XX:+PrintGC -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+UseCompressedClassPointers -XX:+UseCompressedOops\n").getBytes())); + assertDataReader(DataReaderSun1_6_0.class, dr.getClass()); + } + + @Test + public void testOpenJdk8DockerMemory2gCpus2() throws IOException { + // Using an OpenJdk8 docker image and letting the JVM decide on the algorithm (--memory=2g --cpus="2") + DataReaderFactory factory = new DataReaderFactory(); + DataReader dr = factory.getDataReader(new GcResourceFile("byteArray"), new ByteArrayInputStream(("OpenJDK 64-Bit Server VM (25.275-b01) for linux-amd64 JRE (1.8.0_275-b01), built on Nov 6 2020 14:10:46 by \"openjdk\" with gcc 4.4.7 20120313 (Red Hat 4.4.7-23)\n" + + "Memory: 4k page, physical 2097152k(2094956k free), swap 1048572k(1048572k free)\n" + + "CommandLine flags: -XX:InitialHeapSize=33554432 -XX:MaxHeapSize=536870912 -XX:+PrintGC -XX:+PrintGCDateStamps -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseParallelGC\n").getBytes())); + assertDataReader(DataReaderSun1_6_0.class, dr.getClass()); + } + @Test public void testOracleG1J8() throws Exception { DataReaderFactory factory = new DataReaderFactory();