test/hotspot/jtreg/gc/TestGenerationPerfCounter.java
author lkorinth
Fri, 08 Feb 2019 11:52:33 +0100
changeset 53693 af078dd4a224
parent 53523 4c5184c56dc2
child 54638 9b8926bf85c1
permissions -rw-r--r--
8217329: JTREG: Clean up, remove unused imports in gc folder Reviewed-by: lmesnik, tschatzl
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
48117
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
     1
/*
53523
4c5184c56dc2 8214799: Add package declaration to each JTREG test case in the gc folder
lkorinth
parents: 50455
diff changeset
     2
 * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
48117
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
     4
 *
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
     7
 * published by the Free Software Foundation.
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
     8
 *
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    13
 * accompanied this code).
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    14
 *
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    18
 *
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    21
 * questions.
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    22
 */
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    23
53523
4c5184c56dc2 8214799: Add package declaration to each JTREG test case in the gc folder
lkorinth
parents: 50455
diff changeset
    24
package gc;
4c5184c56dc2 8214799: Add package declaration to each JTREG test case in the gc folder
lkorinth
parents: 50455
diff changeset
    25
48117
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    26
import static jdk.test.lib.Asserts.*;
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    27
import gc.testlibrary.PerfCounters;
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    28
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    29
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    30
/* @test TestGenerationPerfCounter
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    31
 * @bug 8080345
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    32
 * @requires vm.gc=="null"
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    33
 * @library /test/lib /
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    34
 * @summary Tests that the sun.gc.policy.generations returns 2 for all GCs.
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    35
 * @modules java.base/jdk.internal.misc
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    36
 *          java.compiler
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    37
 *          java.management/sun.management
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    38
 *          jdk.internal.jvmstat/sun.jvmstat.monitor
53523
4c5184c56dc2 8214799: Add package declaration to each JTREG test case in the gc folder
lkorinth
parents: 50455
diff changeset
    39
 * @run main/othervm -XX:+UsePerfData -XX:+UseSerialGC gc.TestGenerationPerfCounter
4c5184c56dc2 8214799: Add package declaration to each JTREG test case in the gc folder
lkorinth
parents: 50455
diff changeset
    40
 * @run main/othervm -XX:+UsePerfData -XX:+UseParallelGC gc.TestGenerationPerfCounter
4c5184c56dc2 8214799: Add package declaration to each JTREG test case in the gc folder
lkorinth
parents: 50455
diff changeset
    41
 * @run main/othervm -XX:+UsePerfData -XX:+UseG1GC gc.TestGenerationPerfCounter
50455
2b73cce96dce 8202611: [GRAAL] Exclude CMS GC testing from runs with Graal
kvn
parents: 48117
diff changeset
    42
 */
2b73cce96dce 8202611: [GRAAL] Exclude CMS GC testing from runs with Graal
kvn
parents: 48117
diff changeset
    43
2b73cce96dce 8202611: [GRAAL] Exclude CMS GC testing from runs with Graal
kvn
parents: 48117
diff changeset
    44
/* @test TestGenerationPerfCounterCMS
2b73cce96dce 8202611: [GRAAL] Exclude CMS GC testing from runs with Graal
kvn
parents: 48117
diff changeset
    45
 * @bug 8080345
2b73cce96dce 8202611: [GRAAL] Exclude CMS GC testing from runs with Graal
kvn
parents: 48117
diff changeset
    46
 * @comment Graal does not support CMS
2b73cce96dce 8202611: [GRAAL] Exclude CMS GC testing from runs with Graal
kvn
parents: 48117
diff changeset
    47
 * @requires vm.gc=="null" & !vm.graal.enabled
2b73cce96dce 8202611: [GRAAL] Exclude CMS GC testing from runs with Graal
kvn
parents: 48117
diff changeset
    48
 * @library /test/lib /
2b73cce96dce 8202611: [GRAAL] Exclude CMS GC testing from runs with Graal
kvn
parents: 48117
diff changeset
    49
 * @summary Tests that the sun.gc.policy.generations returns 2 for all GCs.
2b73cce96dce 8202611: [GRAAL] Exclude CMS GC testing from runs with Graal
kvn
parents: 48117
diff changeset
    50
 * @modules java.base/jdk.internal.misc
2b73cce96dce 8202611: [GRAAL] Exclude CMS GC testing from runs with Graal
kvn
parents: 48117
diff changeset
    51
 *          java.compiler
2b73cce96dce 8202611: [GRAAL] Exclude CMS GC testing from runs with Graal
kvn
parents: 48117
diff changeset
    52
 *          java.management/sun.management
2b73cce96dce 8202611: [GRAAL] Exclude CMS GC testing from runs with Graal
kvn
parents: 48117
diff changeset
    53
 *          jdk.internal.jvmstat/sun.jvmstat.monitor
53523
4c5184c56dc2 8214799: Add package declaration to each JTREG test case in the gc folder
lkorinth
parents: 50455
diff changeset
    54
 * @run main/othervm -XX:+UsePerfData -XX:+UseConcMarkSweepGC gc.TestGenerationPerfCounter
48117
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    55
 */
50455
2b73cce96dce 8202611: [GRAAL] Exclude CMS GC testing from runs with Graal
kvn
parents: 48117
diff changeset
    56
48117
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    57
public class TestGenerationPerfCounter {
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    58
    public static void main(String[] args) throws Exception {
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    59
        long numGenerations =
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    60
            PerfCounters.findByName("sun.gc.policy.generations").longValue();
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    61
        assertEQ(numGenerations, 2L);
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    62
    }
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    63
}