Skip to content

Commit

Permalink
fix small issue with -XX:+PrintGCCause combined with -XX:+PrintTenuri…
Browse files Browse the repository at this point in the history
…ngDistribution with parallel gc algorithm
  • Loading branch information
chewiebug committed Sep 22, 2015
1 parent d5fc109 commit 548275d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ private boolean isPrintTenuringDistribution(String line) {
|| line.endsWith("[ParNew") // parallel young (CMS, parallel GC)
|| line.endsWith(" (promotion failed)") // CMS (if -XX:+PrintPromotionFailure is active, additional text between "ParNew" + "(promotion failed)" is introduced...)
|| line.endsWith("[GC") // PSYoungGen (parallel sweep)
|| (line.contains("[GC ") && line.endsWith(") ")); // parallel GC (-XX:+PrintGCCause); ends actually with "[GC (Allocation Failure) ", but text in paranthesis can vary
|| (line.contains("[GC (") && (line.endsWith(") ") || line.endsWith(")"))); // parallel GC (-XX:+PrintGCCause); ends actually with "[GC (Allocation Failure) ", but text in paranthesis can vary; there may be a " " in the end
}

private boolean isCmsScavengeBeforeRemark(String line) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,28 @@ public void parallelPrintGCApplicationStoppedTime() throws Exception {
assertThat("number of parse problems", handler.getCount(), is(0));
}

@Test
/**
* The only difference, between this test and {@link TestDataReaderSun1_8_0#parallelPrintTenuringGcCause()}
* is the missing space character in the end of the line before the TenuringDistribution information.
*/
public void parallelPrintTenuringGcCause() throws Exception {
TestLogHandler handler = new TestLogHandler();
handler.setLevel(Level.WARNING);
IMP_LOGGER.addHandler(handler);
DATA_READER_FACTORY_LOGGER.addHandler(handler);

InputStream in = getInputStream("SampleSun1_7_0Parallel_Tenuring_PrintGCCause.txt");
DataReader reader = new DataReaderSun1_6_0(in, GcLogType.SUN1_7);
GCModel model = reader.read();

assertThat("gc count", model.size(), is(2));
assertThat("gc name", model.get(0).getTypeAsString(), equalTo("GC (Allocation Failure); PSYoungGen"));
assertThat("pause", model.get(0).getPause(), closeTo(0.0278950, 0.000000001));

assertEquals("number of errors", 0, handler.getCount());
}

@Test
public void cmsPrintGCApplicationStopped() throws Exception {
TestLogHandler handler = new TestLogHandler();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
2015-09-18T18:18:04.343+0200: 319,347: Application time: 1,5116630 seconds
2015-09-18T18:18:04.344+0200: 319,348: [GC (Allocation Failure)
Desired survivor size 89128960 bytes, new threshold 1 (max 30)
[PSYoungGen: 372359K->5648K(437248K)] 450503K->96997K(699392K), 0,0278950 secs] [Times: user=0,14 sys=0,05, real=0,03 secs]
2015-09-18T18:18:04.373+0200: 319,377: Total time for which application threads were stopped: 0,0298220 seconds, Stopping threads took: 0,0003530 seconds

0 comments on commit 548275d

Please sign in to comment.