< prev index next >

test/gc/g1/TestGCLogMessages.java

Print this page
rev 7518 : 8048179: Early reclaim of large objects that are referenced by a few objects
Summary:
Reviewed-by:


   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test TestGCLogMessages
  26  * @bug 8035406 8027295 8035398 8019342 8027959
  27  * @summary Ensure that the PrintGCDetails output for a minor GC with G1
  28  * includes the expected necessary messages.
  29  * @key gc
  30  * @library /testlibrary
  31  */
  32 
  33 import com.oracle.java.testlibrary.ProcessTools;
  34 import com.oracle.java.testlibrary.OutputAnalyzer;
  35 
  36 public class TestGCLogMessages {
  37   public static void main(String[] args) throws Exception {
  38     testNormalLogs();
  39     testWithToSpaceExhaustionLogs();
  40   }
  41 
  42   private static void testNormalLogs() throws Exception {
  43 
  44     ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
  45                                                               "-Xmx10M",
  46                                                               GCTest.class.getName());
  47 
  48     OutputAnalyzer output = new OutputAnalyzer(pb.start());
  49 
  50     output.shouldNotContain("[Redirty Cards");
  51     output.shouldNotContain("[Parallel Redirty");
  52     output.shouldNotContain("[Redirtied Cards");
  53     output.shouldNotContain("[Code Root Purge");
  54     output.shouldNotContain("[String Dedup Fixup");
  55     output.shouldNotContain("[Young Free CSet");
  56     output.shouldNotContain("[Non-Young Free CSet");

  57     output.shouldNotContain("[Humongous Reclaim");
  58     output.shouldHaveExitValue(0);
  59 
  60     pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
  61                                                "-XX:+UseStringDeduplication",
  62                                                "-Xmx10M",
  63                                                "-XX:+PrintGCDetails",
  64                                                GCTest.class.getName());
  65 
  66     output = new OutputAnalyzer(pb.start());
  67 
  68     output.shouldContain("[Redirty Cards");
  69     output.shouldNotContain("[Parallel Redirty");
  70     output.shouldNotContain("[Redirtied Cards");
  71     output.shouldContain("[Code Root Purge");
  72     output.shouldContain("[String Dedup Fixup");
  73     output.shouldNotContain("[Young Free CSet");
  74     output.shouldNotContain("[Non-Young Free CSet");
  75     output.shouldContain("[Humongous Reclaim");
  76     output.shouldNotContain("[Humongous Total");
  77     output.shouldNotContain("[Humongous Candidate");

  78     output.shouldNotContain("[Humongous Reclaimed");
  79     output.shouldHaveExitValue(0);
  80 
  81     pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
  82                                                "-XX:+UseStringDeduplication",
  83                                                "-Xmx10M",
  84                                                "-XX:+PrintGCDetails",
  85                                                "-XX:+UnlockExperimentalVMOptions",
  86                                                "-XX:G1LogLevel=finest",
  87                                                GCTest.class.getName());
  88 
  89     output = new OutputAnalyzer(pb.start());
  90 
  91     output.shouldContain("[Redirty Cards");
  92     output.shouldContain("[Parallel Redirty");
  93     output.shouldContain("[Redirtied Cards");
  94     output.shouldContain("[Code Root Purge");
  95     output.shouldContain("[String Dedup Fixup");
  96     output.shouldContain("[Young Free CSet");
  97     output.shouldContain("[Non-Young Free CSet");
  98     output.shouldContain("[Humongous Reclaim");
  99     output.shouldContain("[Humongous Total");
 100     output.shouldContain("[Humongous Candidate");

 101     output.shouldContain("[Humongous Reclaimed");
 102     output.shouldHaveExitValue(0);
 103   }
 104 
 105   private static void testWithToSpaceExhaustionLogs() throws Exception {
 106     ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
 107                                                "-Xmx10M",
 108                                                "-Xmn5M",
 109                                                "-XX:+PrintGCDetails",
 110                                                GCTestWithToSpaceExhaustion.class.getName());
 111 
 112     OutputAnalyzer output = new OutputAnalyzer(pb.start());
 113     output.shouldContain("[Evacuation Failure");
 114     output.shouldNotContain("[Recalculate Used");
 115     output.shouldNotContain("[Remove Self Forwards");
 116     output.shouldNotContain("[Restore RemSet");
 117     output.shouldHaveExitValue(0);
 118 
 119     pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
 120                                                "-Xmx10M",




   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test TestGCLogMessages
  26  * @bug 8035406 8027295 8035398 8019342 8027959 8048179
  27  * @summary Ensure that the PrintGCDetails output for a minor GC with G1
  28  * includes the expected necessary messages.
  29  * @key gc
  30  * @library /testlibrary
  31  */
  32 
  33 import com.oracle.java.testlibrary.ProcessTools;
  34 import com.oracle.java.testlibrary.OutputAnalyzer;
  35 
  36 public class TestGCLogMessages {
  37   public static void main(String[] args) throws Exception {
  38     testNormalLogs();
  39     testWithToSpaceExhaustionLogs();
  40   }
  41 
  42   private static void testNormalLogs() throws Exception {
  43 
  44     ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
  45                                                               "-Xmx10M",
  46                                                               GCTest.class.getName());
  47 
  48     OutputAnalyzer output = new OutputAnalyzer(pb.start());
  49 
  50     output.shouldNotContain("[Redirty Cards");
  51     output.shouldNotContain("[Parallel Redirty");
  52     output.shouldNotContain("[Redirtied Cards");
  53     output.shouldNotContain("[Code Root Purge");
  54     output.shouldNotContain("[String Dedup Fixup");
  55     output.shouldNotContain("[Young Free CSet");
  56     output.shouldNotContain("[Non-Young Free CSet");
  57     output.shouldNotContain("[Humongous Register");
  58     output.shouldNotContain("[Humongous Reclaim");
  59     output.shouldHaveExitValue(0);
  60 
  61     pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
  62                                                "-XX:+UseStringDeduplication",
  63                                                "-Xmx10M",
  64                                                "-XX:+PrintGCDetails",
  65                                                GCTest.class.getName());
  66 
  67     output = new OutputAnalyzer(pb.start());
  68 
  69     output.shouldContain("[Redirty Cards");
  70     output.shouldNotContain("[Parallel Redirty");
  71     output.shouldNotContain("[Redirtied Cards");
  72     output.shouldContain("[Code Root Purge");
  73     output.shouldContain("[String Dedup Fixup");
  74     output.shouldNotContain("[Young Free CSet");
  75     output.shouldNotContain("[Non-Young Free CSet");
  76     output.shouldContain("[Humongous Register");
  77     output.shouldNotContain("[Humongous Total");
  78     output.shouldNotContain("[Humongous Candidate");
  79     output.shouldContain("[Humongous Reclaim");
  80     output.shouldNotContain("[Humongous Reclaimed");
  81     output.shouldHaveExitValue(0);
  82 
  83     pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
  84                                                "-XX:+UseStringDeduplication",
  85                                                "-Xmx10M",
  86                                                "-XX:+PrintGCDetails",
  87                                                "-XX:+UnlockExperimentalVMOptions",
  88                                                "-XX:G1LogLevel=finest",
  89                                                GCTest.class.getName());
  90 
  91     output = new OutputAnalyzer(pb.start());
  92 
  93     output.shouldContain("[Redirty Cards");
  94     output.shouldContain("[Parallel Redirty");
  95     output.shouldContain("[Redirtied Cards");
  96     output.shouldContain("[Code Root Purge");
  97     output.shouldContain("[String Dedup Fixup");
  98     output.shouldContain("[Young Free CSet");
  99     output.shouldContain("[Non-Young Free CSet");
 100     output.shouldContain("[Humongous Register");
 101     output.shouldContain("[Humongous Total");
 102     output.shouldContain("[Humongous Candidate");
 103     output.shouldContain("[Humongous Reclaim");
 104     output.shouldContain("[Humongous Reclaimed");
 105     output.shouldHaveExitValue(0);
 106   }
 107 
 108   private static void testWithToSpaceExhaustionLogs() throws Exception {
 109     ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
 110                                                "-Xmx10M",
 111                                                "-Xmn5M",
 112                                                "-XX:+PrintGCDetails",
 113                                                GCTestWithToSpaceExhaustion.class.getName());
 114 
 115     OutputAnalyzer output = new OutputAnalyzer(pb.start());
 116     output.shouldContain("[Evacuation Failure");
 117     output.shouldNotContain("[Recalculate Used");
 118     output.shouldNotContain("[Remove Self Forwards");
 119     output.shouldNotContain("[Restore RemSet");
 120     output.shouldHaveExitValue(0);
 121 
 122     pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
 123                                                "-Xmx10M",


< prev index next >