author | jiangli |
Fri, 02 Nov 2018 19:30:31 -0400 | |
changeset 52397 | 1322829d1501 |
parent 50455 | 2b73cce96dce |
child 53523 | 4c5184c56dc2 |
permissions | -rw-r--r-- |
48117
d64722b0b371
8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff
changeset
|
1 |
/* |
50455
2b73cce96dce
8202611: [GRAAL] Exclude CMS GC testing from runs with Graal
kvn
parents:
48117
diff
changeset
|
2 |
* Copyright (c) 2017, 2018, 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 |
|
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 |
50455
2b73cce96dce
8202611: [GRAAL] Exclude CMS GC testing from runs with Graal
kvn
parents:
48117
diff
changeset
|
41 |
*/ |
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 |
/* @test TestGenerationPerfCounterCMS |
2b73cce96dce
8202611: [GRAAL] Exclude CMS GC testing from runs with Graal
kvn
parents:
48117
diff
changeset
|
44 |
* @bug 8080345 |
2b73cce96dce
8202611: [GRAAL] Exclude CMS GC testing from runs with Graal
kvn
parents:
48117
diff
changeset
|
45 |
* @comment Graal does not support CMS |
2b73cce96dce
8202611: [GRAAL] Exclude CMS GC testing from runs with Graal
kvn
parents:
48117
diff
changeset
|
46 |
* @requires vm.gc=="null" & !vm.graal.enabled |
2b73cce96dce
8202611: [GRAAL] Exclude CMS GC testing from runs with Graal
kvn
parents:
48117
diff
changeset
|
47 |
* @library /test/lib / |
2b73cce96dce
8202611: [GRAAL] Exclude CMS GC testing from runs with Graal
kvn
parents:
48117
diff
changeset
|
48 |
* @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
|
49 |
* @modules java.base/jdk.internal.misc |
2b73cce96dce
8202611: [GRAAL] Exclude CMS GC testing from runs with Graal
kvn
parents:
48117
diff
changeset
|
50 |
* java.compiler |
2b73cce96dce
8202611: [GRAAL] Exclude CMS GC testing from runs with Graal
kvn
parents:
48117
diff
changeset
|
51 |
* java.management/sun.management |
2b73cce96dce
8202611: [GRAAL] Exclude CMS GC testing from runs with Graal
kvn
parents:
48117
diff
changeset
|
52 |
* jdk.internal.jvmstat/sun.jvmstat.monitor |
48117
d64722b0b371
8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff
changeset
|
53 |
* @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
|
54 |
*/ |
50455
2b73cce96dce
8202611: [GRAAL] Exclude CMS GC testing from runs with Graal
kvn
parents:
48117
diff
changeset
|
55 |
|
48117
d64722b0b371
8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff
changeset
|
56 |
public class TestGenerationPerfCounter { |
d64722b0b371
8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff
changeset
|
57 |
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
|
58 |
long numGenerations = |
d64722b0b371
8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff
changeset
|
59 |
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
|
60 |
assertEQ(numGenerations, 2L); |
d64722b0b371
8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff
changeset
|
61 |
} |
d64722b0b371
8080345: With perm gen gone, perfdata counter sun.gc.policy.generations should be 2, not 3
ehelin
parents:
diff
changeset
|
62 |
} |