test/hotspot/jtreg/runtime/cds/appcds/LotsOfClasses.java
author chegar
Thu, 17 Oct 2019 20:54:25 +0100
branchdatagramsocketimpl-branch
changeset 58679 9c3209ff7550
parent 58678 9cf78a70fa4f
parent 58528 d0519b8bd8d9
permissions -rw-r--r--
datagramsocketimpl-branch: merge with default
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
52631
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
     1
/*
54927
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 52811
diff changeset
     2
 * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
52631
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
     4
 *
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
     7
 * published by the Free Software Foundation.
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
     8
 *
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    13
 * accompanied this code).
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    14
 *
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    18
 *
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    21
 * questions.
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    22
 *
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    23
 */
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    24
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    25
import java.util.ArrayList;
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    26
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    27
import jdk.test.lib.cds.CDSTestUtils;
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    28
import jdk.test.lib.cds.CDSOptions;
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    29
import jdk.test.lib.process.OutputAnalyzer;
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    30
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    31
/*
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    32
 * @test
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    33
 * @summary Try to archive lots of classes by searching for classes from the jrt:/ file system. With JDK 12
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    34
 *          this will produce an archive with over 30,000 classes.
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    35
 * @requires vm.cds
57567
b000362a89a0 8202339: [TESTBUG] Consolidate the tests in runtime/SharedArchiveFile and runtime/appcds
coleenp
parents: 54927
diff changeset
    36
 * @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds
52631
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    37
 * @run driver/timeout=500 LotsOfClasses
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    38
 */
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    39
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    40
public class LotsOfClasses {
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    41
58528
d0519b8bd8d9 8231529: [TESTBUG] runtime/cds/appcds/dynamicArchive/DynamicLotsOfClasses.java shouldn't wrap SkippedException into Exception
ccheung
parents: 57567
diff changeset
    42
    public static void main(String[] args) throws Exception {
52631
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    43
        ArrayList<String> list = new ArrayList<>();
54927
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 52811
diff changeset
    44
        TestCommon.findAllClasses(list);
52631
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    45
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    46
        CDSOptions opts = new CDSOptions();
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    47
        opts.setClassList(list);
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    48
        opts.addSuffix("--add-modules");
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    49
        opts.addSuffix("ALL-SYSTEM");
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    50
        opts.addSuffix("-Xlog:hashtables");
52702
10c6e9066819 8214217: [TESTBUG] runtime/appcds/LotsOfClasses.java failed with fragmented heap
jiangli
parents: 52631
diff changeset
    51
        opts.addSuffix("-Xmx500m");
52811
ff04b71bf6f1 8214388: CDS dumping fails with java heap fragmentation
iklam
parents: 52702
diff changeset
    52
        opts.addSuffix("-Xlog:gc+region+cds");
ff04b71bf6f1 8214388: CDS dumping fails with java heap fragmentation
iklam
parents: 52702
diff changeset
    53
        opts.addSuffix("-Xlog:gc+region=trace");
52631
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    54
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    55
        OutputAnalyzer out = CDSTestUtils.createArchive(opts);
52811
ff04b71bf6f1 8214388: CDS dumping fails with java heap fragmentation
iklam
parents: 52702
diff changeset
    56
        CDSTestUtils.checkDump(out);
52631
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    57
    }
3009ca99de32 8213587: Speed up CDS dump time by using resizable hashtables
iklam
parents:
diff changeset
    58
}