TestRemsetLoggingPerRegion.java revision 9727:f944761a3ce3
1139825Simp/*
2148078Srwatson * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
3148078Srwatson * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4148078Srwatson *
592654Sjeff * This code is free software; you can redistribute it and/or modify it
692654Sjeff * under the terms of the GNU General Public License version 2 only, as
792654Sjeff * published by the Free Software Foundation.
892654Sjeff *
992654Sjeff * This code is distributed in the hope that it will be useful, but WITHOUT
1092654Sjeff * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1192654Sjeff * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1292654Sjeff * version 2 for more details (a copy is included in the LICENSE file that
1392654Sjeff * accompanied this code).
1492654Sjeff *
1592654Sjeff * You should have received a copy of the GNU General Public License version
1692654Sjeff * 2 along with this work; if not, write to the Free Software Foundation,
1792654Sjeff * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1892654Sjeff *
1992654Sjeff * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2092654Sjeff * or visit www.oracle.com if you need additional information or have any
2192654Sjeff * questions.
2292654Sjeff */
2392654Sjeff
2492654Sjeff/*
2592654Sjeff * @test TestRemsetLoggingPerRegion.java
2692654Sjeff * @bug 8014078 8129977
2792654Sjeff * @library /testlibrary
2892654Sjeff * @modules java.base/sun.misc
2992654Sjeff *          java.management/sun.management
3092654Sjeff * @build TestRemsetLoggingTools TestRemsetLoggingPerRegion
3192654Sjeff * @summary Verify output of -Xlog:gc+remset*=trace in regards to per-region type output
3292654Sjeff * @run main TestRemsetLoggingPerRegion
3392654Sjeff */
3492654Sjeff
3592654Sjeffimport jdk.test.lib.*;
36262739Sglebiusimport java.lang.Thread;
37262739Sglebiusimport java.util.ArrayList;
3892654Sjeffimport java.util.Arrays;
3992654Sjeff
4092654Sjeffpublic class TestRemsetLoggingPerRegion {
4192654Sjeff
42184546Skeramida    public static void main(String[] args) throws Exception {
4392654Sjeff        String result;
4492654Sjeff
4592654Sjeff        if (!TestRemsetLoggingTools.testingG1GC()) {
4692654Sjeff            return;
47129906Sbmilekic        }
4892654Sjeff
4992654Sjeff        // single remembered set summary output at the end
5092654Sjeff        result = TestRemsetLoggingTools.runTest(new String[] { "-Xlog:gc+remset*=trace" }, 0);
51166213Smohans        TestRemsetLoggingTools.expectPerRegionRSetSummaries(result, 1, 0);
52166213Smohans
53244024Spjd        // two times remembered set summary output
5492654Sjeff        result = TestRemsetLoggingTools.runTest(new String[] { "-Xlog:gc+remset*=trace", "-XX:G1SummarizeRSetStatsPeriod=1" }, 1);
5592654Sjeff        TestRemsetLoggingTools.expectPerRegionRSetSummaries(result, 1, 2);
5692654Sjeff    }
5792654Sjeff}
5892654Sjeff