author | chegar |
Sat, 09 Apr 2016 23:03:39 +0100 | |
changeset 36851 | 03e2f4d0a421 |
parent 35061 | be6025ebffea |
child 40631 | ed82623d7831 |
permissions | -rw-r--r-- |
33103
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
1 |
/* |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
4 |
* |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
8 |
* |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
13 |
* accompanied this code). |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
14 |
* |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
18 |
* |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
21 |
* questions. |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
22 |
*/ |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
23 |
|
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
24 |
/* |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
25 |
* @test TestPrintReferences |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
26 |
* @bug 8136991 |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
27 |
* @summary Validate the reference processing logging |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
28 |
* @key gc |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
29 |
* @library /testlibrary |
36851 | 30 |
* @modules java.base/jdk.internal.misc |
33103
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
31 |
* java.management |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
32 |
*/ |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
33 |
|
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
34 |
import jdk.test.lib.ProcessTools; |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
35 |
import jdk.test.lib.OutputAnalyzer; |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
36 |
|
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
37 |
public class TestPrintReferences { |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
38 |
public static void main(String[] args) throws Exception { |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
39 |
ProcessBuilder pb_enabled = |
35061 | 40 |
ProcessTools.createJavaProcessBuilder("-Xlog:gc+ref=debug", "-Xmx10M", GCTest.class.getName()); |
33103
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
41 |
OutputAnalyzer output = new OutputAnalyzer(pb_enabled.start()); |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
42 |
|
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
43 |
String countRegex = "[0-9]+ refs"; |
35061 | 44 |
String timeRegex = "\\([0-9]+[.,][0-9]+s, [0-9]+[.,][0-9]+s\\) [0-9]+[.,][0-9]+ms"; |
33103
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
45 |
|
35061 | 46 |
output.shouldMatch(".* GC\\([0-9]+\\) SoftReference " + timeRegex + "\n" + |
47 |
".* GC\\([0-9]+\\) WeakReference " + timeRegex + "\n" + |
|
48 |
".* GC\\([0-9]+\\) FinalReference " + timeRegex + "\n" + |
|
49 |
".* GC\\([0-9]+\\) PhantomReference " + timeRegex + "\n" + |
|
50 |
".* GC\\([0-9]+\\) JNI Weak Reference " + timeRegex + "\n" + |
|
51 |
".* GC\\([0-9]+\\) Ref Counts: Soft: [0-9]+ Weak: [0-9]+ Final: [0-9]+ Phantom: [0-9]+\n"); |
|
33103
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
52 |
|
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
53 |
output.shouldHaveExitValue(0); |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
54 |
} |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
55 |
|
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
56 |
static class GCTest { |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
57 |
public static void main(String [] args) { |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
58 |
System.gc(); |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
59 |
} |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
60 |
} |
116b558af514
8136991: [REDO] Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
brutisso
parents:
diff
changeset
|
61 |
} |