Mercurial > hg > truffle
annotate test/gc/g1/TestHumongousAllocInitialMark.java @ 18064:177fc018b5b2
Merge
author | asaha |
---|---|
date | Thu, 05 Jun 2014 15:20:57 -0700 |
parents | 55fb97c4c58d |
children | 4ca6dc0799b6 |
rev | line source |
---|---|
6105
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
1 /* |
17467
55fb97c4c58d
8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
mikael
parents:
12898
diff
changeset
|
2 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. |
6105
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
4 * |
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
8 * |
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
13 * accompanied this code). |
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
14 * |
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
18 * |
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
21 * questions. |
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
22 */ |
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
23 |
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
24 /* |
12898
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
25 * @test TestHumongousAllocInitialMark |
6105
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
26 * @bug 7168848 |
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
27 * @summary G1: humongous object allocations should initiate marking cycles when necessary |
12898
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
28 * @library /testlibrary |
6105
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
29 */ |
12898
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
30 |
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
31 import com.oracle.java.testlibrary.*; |
6105
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
32 |
12898
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
33 public class TestHumongousAllocInitialMark { |
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
34 private static final int heapSize = 200; // MB |
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
35 private static final int heapRegionSize = 1; // MB |
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
36 private static final int initiatingHeapOccupancyPercent = 50; // % |
6105
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
37 |
12898
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
38 public static void main(String[] args) throws Exception { |
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
39 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( |
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
40 "-XX:+UseG1GC", |
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
41 "-Xms" + heapSize + "m", |
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
42 "-Xmx" + heapSize + "m", |
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
43 "-XX:G1HeapRegionSize=" + heapRegionSize + "m", |
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
44 "-XX:InitiatingHeapOccupancyPercent=" + initiatingHeapOccupancyPercent, |
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
45 "-XX:+PrintGC", |
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
46 HumongousObjectAllocator.class.getName()); |
6105
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
47 |
12898
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
48 OutputAnalyzer output = new OutputAnalyzer(pb.start()); |
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
49 output.shouldContain("GC pause (G1 Humongous Allocation) (young) (initial-mark)"); |
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
50 output.shouldNotContain("Full GC"); |
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
51 output.shouldHaveExitValue(0); |
6105
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
52 } |
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
53 |
12898
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
54 static class HumongousObjectAllocator { |
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
55 private static byte[] dummy; |
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
56 |
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
57 public static void main(String [] args) throws Exception { |
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
58 // Make object size 75% of region size |
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
59 final int humongousObjectSize = |
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
60 (int)(heapRegionSize * 1024 * 1024 * 0.75); |
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
61 |
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
62 // Number of objects to allocate to go above IHOP |
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
63 final int humongousObjectAllocations = |
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
64 (int)((heapSize * initiatingHeapOccupancyPercent / 100.0) / heapRegionSize) + 1; |
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
65 |
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
66 // Allocate |
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
67 for (int i = 1; i <= humongousObjectAllocations; i++) { |
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
68 System.out.println("Allocating humongous object " + i + "/" + humongousObjectAllocations + |
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
69 " of size " + humongousObjectSize + " bytes"); |
6f1919cfd18c
8023158: hotspot/test/gc/7168848/HumongousAlloc.java fails 14 full gcs, expect 0 full gcs
pliden
parents:
6105
diff
changeset
|
70 dummy = new byte[humongousObjectSize]; |
6105
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
71 } |
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
72 } |
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
73 } |
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
74 } |
9a344d88dc22
7168848: Add test to check that humongous object allocation path also checks the heap occupancy.
mnunez
parents:
diff
changeset
|
75 |