15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 import java.io.BufferedReader; 25 import java.io.File; 26 import java.io.FileNotFoundException; 27 import java.io.FileReader; 28 import java.io.IOException; 29 import java.io.Reader; 30 import java.nio.CharBuffer; 31 import java.util.Arrays; 32 import java.util.Scanner; 33 34 import jdk.test.lib.Asserts; 35 import jdk.test.lib.JDKToolFinder; 36 import jdk.test.lib.JDKToolLauncher; 37 import jdk.test.lib.OutputAnalyzer; 38 import jdk.test.lib.Platform; 39 import jdk.test.lib.ProcessTools; 40 41 /* 42 * @test 43 * @bug 6313383 44 * @key regression 45 * @summary Regression test for hprof export issue due to large heaps (>2G) 46 * Started failing on 2016.06.24 due to 8160376 on MacOS X so quarantine 47 * it on that platform: 48 * @requires os.family != "mac" 49 * @library /testlibrary 50 * @modules java.base/jdk.internal.misc 51 * java.compiler 52 * java.management/sun.management 53 * jdk.jvmstat/sun.jvmstat.monitor 54 * @build jdk.test.lib.* JMapHProfLargeHeapProc 55 * @run main JMapHProfLargeHeapTest 56 */ 57 58 public class JMapHProfLargeHeapTest { 59 private static final String HEAP_DUMP_FILE_NAME = "heap.bin"; 60 private static final String HPROF_HEADER_1_0_1 = "JAVA PROFILE 1.0.1"; 61 private static final String HPROF_HEADER_1_0_2 = "JAVA PROFILE 1.0.2"; 62 private static final long M = 1024L; 63 private static final long G = 1024L * M; 64 65 public static void main(String[] args) throws Exception { 66 if (!Platform.shouldSAAttach()) { 67 System.out.println("SA attach not expected to work - test skipped."); 68 return; 69 } 70 71 // All heap dumps should create 1.0.2 file format 72 // Hotspot internal heapdumper always use HPROF_HEADER_1_0_2 format, 73 // but SA heapdumper still use HPROF_HEADER_1_0_1 for small heaps 74 testHProfFileFormat("-Xmx1g", 22 * M, HPROF_HEADER_1_0_1); | 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 import java.io.BufferedReader; 25 import java.io.File; 26 import java.io.FileNotFoundException; 27 import java.io.FileReader; 28 import java.io.IOException; 29 import java.io.Reader; 30 import java.nio.CharBuffer; 31 import java.util.Arrays; 32 import java.util.Scanner; 33 34 import jdk.test.lib.Asserts; 35 import jdk.test.lib.JDKToolLauncher; 36 import jdk.test.lib.Platform; 37 import jdk.test.lib.process.OutputAnalyzer; 38 import jdk.test.lib.process.ProcessTools; 39 40 /* 41 * @test 42 * @bug 6313383 43 * @key regression 44 * @summary Regression test for hprof export issue due to large heaps (>2G) 45 * Started failing on 2016.06.24 due to 8160376 on MacOS X so quarantine 46 * it on that platform: 47 * @requires os.family != "mac" 48 * @library /test/lib 49 * @modules java.base/jdk.internal.misc 50 * java.compiler 51 * java.management/sun.management 52 * jdk.jvmstat/sun.jvmstat.monitor 53 * @build JMapHProfLargeHeapProc 54 * @run main JMapHProfLargeHeapTest 55 */ 56 57 public class JMapHProfLargeHeapTest { 58 private static final String HEAP_DUMP_FILE_NAME = "heap.bin"; 59 private static final String HPROF_HEADER_1_0_1 = "JAVA PROFILE 1.0.1"; 60 private static final String HPROF_HEADER_1_0_2 = "JAVA PROFILE 1.0.2"; 61 private static final long M = 1024L; 62 private static final long G = 1024L * M; 63 64 public static void main(String[] args) throws Exception { 65 if (!Platform.shouldSAAttach()) { 66 System.out.println("SA attach not expected to work - test skipped."); 67 return; 68 } 69 70 // All heap dumps should create 1.0.2 file format 71 // Hotspot internal heapdumper always use HPROF_HEADER_1_0_2 format, 72 // but SA heapdumper still use HPROF_HEADER_1_0_1 for small heaps 73 testHProfFileFormat("-Xmx1g", 22 * M, HPROF_HEADER_1_0_1); |