Mon, 24 Mar 2014 15:30:36 +0100
8027295: Free CSet takes ~50% of young pause time
Summary: Improve fast card cache iteration and avoid taking locks when freeing the collection set.
Reviewed-by: brutisso
tschatzl@6402 | 1 | /* |
tschatzl@6402 | 2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
tschatzl@6402 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
tschatzl@6402 | 4 | * |
tschatzl@6402 | 5 | * This code is free software; you can redistribute it and/or modify it |
tschatzl@6402 | 6 | * under the terms of the GNU General Public License version 2 only, as |
tschatzl@6402 | 7 | * published by the Free Software Foundation. |
tschatzl@6402 | 8 | * |
tschatzl@6402 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
tschatzl@6402 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
tschatzl@6402 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
tschatzl@6402 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
tschatzl@6402 | 13 | * accompanied this code). |
tschatzl@6402 | 14 | * |
tschatzl@6402 | 15 | * You should have received a copy of the GNU General Public License version |
tschatzl@6402 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
tschatzl@6402 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
tschatzl@6402 | 18 | * |
tschatzl@6402 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
tschatzl@6402 | 20 | * or visit www.oracle.com if you need additional information or have any |
tschatzl@6402 | 21 | * questions. |
tschatzl@6402 | 22 | */ |
tschatzl@6402 | 23 | |
tschatzl@6402 | 24 | /* |
tschatzl@6402 | 25 | * @test TestPrintGCDetails |
tschatzl@6404 | 26 | * @bug 8035406 8027295 |
tschatzl@6402 | 27 | * @summary Ensure that the PrintGCDetails output for a minor GC with G1 |
tschatzl@6402 | 28 | * includes the expected necessary messages. |
tschatzl@6402 | 29 | * @key gc |
tschatzl@6402 | 30 | * @library /testlibrary |
tschatzl@6402 | 31 | */ |
tschatzl@6402 | 32 | |
tschatzl@6402 | 33 | import com.oracle.java.testlibrary.ProcessTools; |
tschatzl@6402 | 34 | import com.oracle.java.testlibrary.OutputAnalyzer; |
tschatzl@6402 | 35 | |
tschatzl@6402 | 36 | public class TestGCLogMessages { |
tschatzl@6402 | 37 | public static void main(String[] args) throws Exception { |
tschatzl@6402 | 38 | |
tschatzl@6402 | 39 | ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", |
tschatzl@6402 | 40 | "-Xmx10M", |
tschatzl@6402 | 41 | GCTest.class.getName()); |
tschatzl@6402 | 42 | |
tschatzl@6402 | 43 | OutputAnalyzer output = new OutputAnalyzer(pb.start()); |
tschatzl@6402 | 44 | |
tschatzl@6404 | 45 | output.shouldNotContain("[Code Root Purge"); |
tschatzl@6404 | 46 | output.shouldNotContain("[Young Free CSet"); |
tschatzl@6404 | 47 | output.shouldNotContain("[Non-Young Free CSet"); |
tschatzl@6404 | 48 | output.shouldHaveExitValue(0); |
tschatzl@6404 | 49 | |
tschatzl@6404 | 50 | pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", |
tschatzl@6404 | 51 | "-Xmx10M", |
tschatzl@6404 | 52 | "-XX:+PrintGCDetails", |
tschatzl@6404 | 53 | GCTest.class.getName()); |
tschatzl@6404 | 54 | |
tschatzl@6404 | 55 | output = new OutputAnalyzer(pb.start()); |
tschatzl@6404 | 56 | |
tschatzl@6402 | 57 | output.shouldContain("[Code Root Purge"); |
tschatzl@6404 | 58 | output.shouldNotContain("[Young Free CSet"); |
tschatzl@6404 | 59 | output.shouldNotContain("[Non-Young Free CSet"); |
tschatzl@6402 | 60 | output.shouldHaveExitValue(0); |
tschatzl@6404 | 61 | |
tschatzl@6404 | 62 | pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", |
tschatzl@6404 | 63 | "-Xmx10M", |
tschatzl@6404 | 64 | "-XX:+PrintGCDetails", |
tschatzl@6404 | 65 | "-XX:+UnlockExperimentalVMOptions", |
tschatzl@6404 | 66 | "-XX:G1LogLevel=finest", |
tschatzl@6404 | 67 | GCTest.class.getName()); |
tschatzl@6404 | 68 | |
tschatzl@6404 | 69 | output = new OutputAnalyzer(pb.start()); |
tschatzl@6404 | 70 | |
tschatzl@6404 | 71 | output.shouldContain("[Code Root Purge"); |
tschatzl@6404 | 72 | output.shouldContain("[Young Free CSet"); |
tschatzl@6404 | 73 | output.shouldContain("[Non-Young Free CSet"); |
tschatzl@6404 | 74 | output.shouldHaveExitValue(0); |
tschatzl@6404 | 75 | |
tschatzl@6402 | 76 | } |
tschatzl@6402 | 77 | |
tschatzl@6402 | 78 | static class GCTest { |
tschatzl@6402 | 79 | private static byte[] garbage; |
tschatzl@6402 | 80 | public static void main(String [] args) { |
tschatzl@6402 | 81 | System.out.println("Creating garbage"); |
tschatzl@6402 | 82 | // create 128MB of garbage. This should result in at least one GC |
tschatzl@6402 | 83 | for (int i = 0; i < 1024; i++) { |
tschatzl@6402 | 84 | garbage = new byte[128 * 1024]; |
tschatzl@6402 | 85 | } |
tschatzl@6402 | 86 | System.out.println("Done"); |
tschatzl@6402 | 87 | } |
tschatzl@6402 | 88 | } |
tschatzl@6402 | 89 | } |