Skip to content

Commit

Permalink
update detection of OpenJdk8 log files
Browse files Browse the repository at this point in the history
  • Loading branch information
chewiebug committed Nov 22, 2020
1 parent 7976cec commit 399d713
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,18 +161,17 @@ else if (s.contains(" (young)") || s.contains("G1Ergonomics") || s.contains(" (m
// G1 logger usually starts with "<timestamp>: [GC pause (young)...]"
// but can start with <timestamp>: [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")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 399d713

Please sign in to comment.