hotspot/test/gc/g1/TestGCLogMessages.java
author tschatzl
Fri, 26 Feb 2016 13:02:30 +0100
changeset 36368 569d6e8072a9
parent 36367 313c87c050f7
child 36374 613f27cc37b9
permissions -rw-r--r--
8150630: Add logging for ParScanThreadState merge phase Summary: Improve visibility of the per-thread scan state merge phase by adding appropriate logging. Reviewed-by: jmasa, tbenson
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23451
ed2b8bb28fed 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff changeset
     1
/*
36367
313c87c050f7 8076463: Add logging for the preserve CM referents task
tschatzl
parents: 35061
diff changeset
     2
 * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
23451
ed2b8bb28fed 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ed2b8bb28fed 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff changeset
     4
 *
ed2b8bb28fed 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
ed2b8bb28fed 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
ed2b8bb28fed 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff changeset
     7
 * published by the Free Software Foundation.
ed2b8bb28fed 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff changeset
     8
 *
ed2b8bb28fed 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
ed2b8bb28fed 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ed2b8bb28fed 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
ed2b8bb28fed 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
ed2b8bb28fed 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff changeset
    13
 * accompanied this code).
ed2b8bb28fed 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff changeset
    14
 *
ed2b8bb28fed 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
ed2b8bb28fed 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
ed2b8bb28fed 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ed2b8bb28fed 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff changeset
    18
 *
ed2b8bb28fed 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ed2b8bb28fed 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
ed2b8bb28fed 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff changeset
    21
 * questions.
ed2b8bb28fed 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff changeset
    22
 */
ed2b8bb28fed 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff changeset
    23
ed2b8bb28fed 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff changeset
    24
/*
24467
886598231964 8038928: gc/g1/TestGCLogMessages.java fail with "[Evacuation Failure'
jmasa
parents: 24104
diff changeset
    25
 * @test TestGCLogMessages
36368
569d6e8072a9 8150630: Add logging for ParScanThreadState merge phase
tschatzl
parents: 36367
diff changeset
    26
 * @bug 8035406 8027295 8035398 8019342 8027959 8048179 8027962 8069330 8076463 8150630
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
    27
 * @summary Ensure the output for a minor GC with G1
23451
ed2b8bb28fed 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff changeset
    28
 * includes the expected necessary messages.
ed2b8bb28fed 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff changeset
    29
 * @key gc
ed2b8bb28fed 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff changeset
    30
 * @library /testlibrary
29678
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 28497
diff changeset
    31
 * @modules java.base/sun.misc
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 28497
diff changeset
    32
 *          java.management
23451
ed2b8bb28fed 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff changeset
    33
 */
ed2b8bb28fed 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff changeset
    34
30604
b8d532cb6420 8067013: Rename the com.oracle.java.testlibary package
ykantser
parents: 30172
diff changeset
    35
import jdk.test.lib.ProcessTools;
b8d532cb6420 8067013: Rename the com.oracle.java.testlibary package
ykantser
parents: 30172
diff changeset
    36
import jdk.test.lib.OutputAnalyzer;
23451
ed2b8bb28fed 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff changeset
    37
ed2b8bb28fed 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff changeset
    38
public class TestGCLogMessages {
23455
e541bff96524 8035654: Add times for evacuation failure handling in "Other" time
tschatzl
parents: 23454
diff changeset
    39
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
    40
    private enum Level {
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
    41
        OFF, DEBUG, TRACE;
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
    42
        public boolean lessOrEqualTo(Level other) {
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
    43
            return this.compareTo(other) < 0;
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
    44
        }
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
    45
    }
23451
ed2b8bb28fed 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff changeset
    46
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
    47
    private class LogMessageWithLevel {
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
    48
        String message;
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
    49
        Level level;
23451
ed2b8bb28fed 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff changeset
    50
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
    51
        public LogMessageWithLevel(String message, Level level) {
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
    52
            this.message = message;
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
    53
            this.level = level;
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
    54
        }
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
    55
    };
23453
09cfb0164acf 8027295: Free CSet takes ~50% of young pause time
tschatzl
parents: 23451
diff changeset
    56
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
    57
    private LogMessageWithLevel allLogMessages[] = new LogMessageWithLevel[] {
33204
b8a3901ac5b3 8069330: Adjustment of concurrent refinement thresholds does not take hot card cache into account
tschatzl
parents: 30604
diff changeset
    58
        // Update RS
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
    59
        new LogMessageWithLevel("Scan HCC", Level.DEBUG),
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
    60
        // Ext Root Scan
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
    61
        new LogMessageWithLevel("Thread Roots:", Level.DEBUG),
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
    62
        new LogMessageWithLevel("StringTable Roots:", Level.DEBUG),
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
    63
        new LogMessageWithLevel("Universe Roots:", Level.DEBUG),
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
    64
        new LogMessageWithLevel("JNI Handles Roots:", Level.DEBUG),
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
    65
        new LogMessageWithLevel("ObjectSynchronizer Roots:", Level.DEBUG),
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
    66
        new LogMessageWithLevel("FlatProfiler Roots", Level.DEBUG),
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
    67
        new LogMessageWithLevel("Management Roots", Level.DEBUG),
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
    68
        new LogMessageWithLevel("SystemDictionary Roots", Level.DEBUG),
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
    69
        new LogMessageWithLevel("CLDG Roots", Level.DEBUG),
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
    70
        new LogMessageWithLevel("JVMTI Roots", Level.DEBUG),
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
    71
        new LogMessageWithLevel("SATB Filtering", Level.DEBUG),
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
    72
        new LogMessageWithLevel("CM RefProcessor Roots", Level.DEBUG),
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
    73
        new LogMessageWithLevel("Wait For Strong CLD", Level.DEBUG),
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
    74
        new LogMessageWithLevel("Weak CLD Roots", Level.DEBUG),
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
    75
        // Redirty Cards
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
    76
        new LogMessageWithLevel("Redirty Cards", Level.DEBUG),
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
    77
        new LogMessageWithLevel("Parallel Redirty", Level.DEBUG),
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
    78
        new LogMessageWithLevel("Redirtied Cards", Level.DEBUG),
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
    79
        // Misc Top-level
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
    80
        new LogMessageWithLevel("Code Root Purge", Level.DEBUG),
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
    81
        new LogMessageWithLevel("String Dedup Fixup", Level.DEBUG),
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
    82
        new LogMessageWithLevel("Expand Heap After Collection", Level.DEBUG),
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
    83
        // Free CSet
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
    84
        new LogMessageWithLevel("Young Free CSet", Level.TRACE),
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
    85
        new LogMessageWithLevel("Non-Young Free CSet", Level.TRACE),
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
    86
        // Humongous Eager Reclaim
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
    87
        new LogMessageWithLevel("Humongous Reclaim", Level.DEBUG),
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
    88
        new LogMessageWithLevel("Humongous Register", Level.DEBUG),
36367
313c87c050f7 8076463: Add logging for the preserve CM referents task
tschatzl
parents: 35061
diff changeset
    89
        // Preserve CM Referents
313c87c050f7 8076463: Add logging for the preserve CM referents task
tschatzl
parents: 35061
diff changeset
    90
        new LogMessageWithLevel("Preserve CM Refs", Level.DEBUG),
36368
569d6e8072a9 8150630: Add logging for ParScanThreadState merge phase
tschatzl
parents: 36367
diff changeset
    91
        // Merge PSS
569d6e8072a9 8150630: Add logging for ParScanThreadState merge phase
tschatzl
parents: 36367
diff changeset
    92
        new LogMessageWithLevel("Merge Per-Thread State", Level.DEBUG),
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
    93
    };
23453
09cfb0164acf 8027295: Free CSet takes ~50% of young pause time
tschatzl
parents: 23451
diff changeset
    94
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
    95
    void checkMessagesAtLevel(OutputAnalyzer output, LogMessageWithLevel messages[], Level level) throws Exception {
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
    96
        for (LogMessageWithLevel l : messages) {
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
    97
            if (level.lessOrEqualTo(l.level)) {
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
    98
                output.shouldNotContain(l.message);
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
    99
            } else {
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   100
                output.shouldContain(l.message);
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   101
            }
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   102
        }
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   103
    }
23453
09cfb0164acf 8027295: Free CSet takes ~50% of young pause time
tschatzl
parents: 23451
diff changeset
   104
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   105
    public static void main(String[] args) throws Exception {
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   106
        new TestGCLogMessages().testNormalLogs();
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   107
        new TestGCLogMessages().testWithToSpaceExhaustionLogs();
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   108
    }
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   109
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   110
    private void testNormalLogs() throws Exception {
23453
09cfb0164acf 8027295: Free CSet takes ~50% of young pause time
tschatzl
parents: 23451
diff changeset
   111
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   112
        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   113
                                                                  "-Xmx10M",
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   114
                                                                  GCTest.class.getName());
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   115
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   116
        OutputAnalyzer output = new OutputAnalyzer(pb.start());
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   117
        checkMessagesAtLevel(output, allLogMessages, Level.OFF);
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   118
        output.shouldHaveExitValue(0);
23453
09cfb0164acf 8027295: Free CSet takes ~50% of young pause time
tschatzl
parents: 23451
diff changeset
   119
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   120
        pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   121
                                                   "-XX:+UseStringDeduplication",
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   122
                                                   "-Xmx10M",
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
   123
                                                   "-Xlog:gc+phases=debug",
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   124
                                                   GCTest.class.getName());
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   125
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   126
        output = new OutputAnalyzer(pb.start());
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
   127
        checkMessagesAtLevel(output, allLogMessages, Level.DEBUG);
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   128
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   129
        pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   130
                                                   "-XX:+UseStringDeduplication",
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   131
                                                   "-Xmx10M",
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
   132
                                                   "-Xlog:gc+phases=trace",
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   133
                                                   GCTest.class.getName());
23455
e541bff96524 8035654: Add times for evacuation failure handling in "Other" time
tschatzl
parents: 23454
diff changeset
   134
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   135
        output = new OutputAnalyzer(pb.start());
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
   136
        checkMessagesAtLevel(output, allLogMessages, Level.TRACE);
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   137
        output.shouldHaveExitValue(0);
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   138
    }
23455
e541bff96524 8035654: Add times for evacuation failure handling in "Other" time
tschatzl
parents: 23454
diff changeset
   139
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   140
    LogMessageWithLevel exhFailureMessages[] = new LogMessageWithLevel[] {
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
   141
        new LogMessageWithLevel("Evacuation Failure", Level.DEBUG),
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
   142
        new LogMessageWithLevel("Recalculate Used", Level.TRACE),
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
   143
        new LogMessageWithLevel("Remove Self Forwards", Level.TRACE),
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
   144
        new LogMessageWithLevel("Restore RemSet", Level.TRACE),
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   145
    };
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   146
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   147
    private void testWithToSpaceExhaustionLogs() throws Exception {
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   148
        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   149
                                                                  "-Xmx32M",
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   150
                                                                  "-Xmn16M",
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
   151
                                                                  "-Xlog:gc+phases=debug",
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   152
                                                                  GCTestWithToSpaceExhaustion.class.getName());
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   153
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   154
        OutputAnalyzer output = new OutputAnalyzer(pb.start());
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
   155
        checkMessagesAtLevel(output, exhFailureMessages, Level.DEBUG);
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   156
        output.shouldHaveExitValue(0);
23453
09cfb0164acf 8027295: Free CSet takes ~50% of young pause time
tschatzl
parents: 23451
diff changeset
   157
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   158
        pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   159
                                                   "-Xmx32M",
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   160
                                                   "-Xmn16M",
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
   161
                                                   "-Xlog:gc+phases=trace",
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   162
                                                   GCTestWithToSpaceExhaustion.class.getName());
23455
e541bff96524 8035654: Add times for evacuation failure handling in "Other" time
tschatzl
parents: 23454
diff changeset
   163
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   164
        output = new OutputAnalyzer(pb.start());
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 33577
diff changeset
   165
        checkMessagesAtLevel(output, exhFailureMessages, Level.TRACE);
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   166
        output.shouldHaveExitValue(0);
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   167
    }
23451
ed2b8bb28fed 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff changeset
   168
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   169
    static class GCTest {
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   170
        private static byte[] garbage;
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   171
        public static void main(String [] args) {
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   172
            System.out.println("Creating garbage");
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   173
            // create 128MB of garbage. This should result in at least one GC
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   174
            for (int i = 0; i < 1024; i++) {
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   175
                garbage = new byte[128 * 1024];
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   176
            }
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   177
            System.out.println("Done");
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   178
        }
23451
ed2b8bb28fed 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff changeset
   179
    }
23455
e541bff96524 8035654: Add times for evacuation failure handling in "Other" time
tschatzl
parents: 23454
diff changeset
   180
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   181
    static class GCTestWithToSpaceExhaustion {
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   182
        private static byte[] garbage;
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   183
        private static byte[] largeObject;
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   184
        public static void main(String [] args) {
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   185
            largeObject = new byte[16*1024*1024];
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   186
            System.out.println("Creating garbage");
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   187
            // create 128MB of garbage. This should result in at least one GC,
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   188
            // some of them with to-space exhaustion.
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   189
            for (int i = 0; i < 1024; i++) {
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   190
                garbage = new byte[128 * 1024];
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   191
            }
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   192
            System.out.println("Done");
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   193
        }
23455
e541bff96524 8035654: Add times for evacuation failure handling in "Other" time
tschatzl
parents: 23454
diff changeset
   194
    }
23451
ed2b8bb28fed 8035406: Improve data structure for Code Cache remembered sets
tschatzl
parents:
diff changeset
   195
}
29694
442c3305ba39 8027962: Per-phase timing measurements for strong roots processing
brutisso
parents: 28497
diff changeset
   196