test/hotspot/jtreg/gc/TestGenerationPerfCounter.java
author shade
Mon, 26 Mar 2018 09:56:36 +0200
branchepsilon-gc-branch
changeset 56348 f3b0961adb3c
parent 48117 d64722b0b371
child 50455 2b73cce96dce
permissions -rw-r--r--
Merge
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
/*
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
     2
 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
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
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    24
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
    25
import gc.testlibrary.PerfCounter;
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    26
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
    27
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
/* @test TestGenerationPerfCounter
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    30
 * @bug 8080345
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    31
 * @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
    32
 * @library /test/lib /
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    33
 * @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
    34
 * @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
    35
 *          java.compiler
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    36
 *          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
    37
 *          jdk.internal.jvmstat/sun.jvmstat.monitor
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    38
 * @run main/othervm -XX:+UsePerfData -XX:+UseSerialGC TestGenerationPerfCounter
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    39
 * @run main/othervm -XX:+UsePerfData -XX:+UseParallelGC TestGenerationPerfCounter
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    40
 * @run main/othervm -XX:+UsePerfData -XX:+UseG1GC TestGenerationPerfCounter
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    41
 * @run main/othervm -XX:+UsePerfData -XX:+UseConcMarkSweepGC TestGenerationPerfCounter
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    42
 */
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    43
public class TestGenerationPerfCounter {
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    44
    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
    45
        long numGenerations =
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    46
            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
    47
        assertEQ(numGenerations, 2L);
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    48
    }
d64722b0b371 8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff changeset
    49
}