Skip to content

Commit

Permalink
8315936: Parallelize gc/stress/TestStressG1Humongous.java test
Browse files Browse the repository at this point in the history
Backport-of: 3f19df685c342cef212305cca630331878a24e79
  • Loading branch information
Ian Myers authored and shipilev committed Nov 27, 2023
1 parent 593ef7c commit 2e55190
Showing 1 changed file with 39 additions and 10 deletions.
49 changes: 39 additions & 10 deletions test/hotspot/jtreg/gc/stress/TestStressG1Humongous.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,41 @@
package gc.stress;

/*
* @test TestStressG1Humongous
* @test
* @key stress
* @summary Stress G1 by humongous allocations in situation near OOM
* @requires vm.gc.G1
* @requires !vm.flightRecorder
* @library /test/lib
* @modules java.base/jdk.internal.misc
* @run driver/timeout=1300 gc.stress.TestStressG1Humongous
* @run driver/timeout=180 gc.stress.TestStressG1Humongous 4 3 1.1 120
*/

/*
* @test
* @requires vm.gc.G1
* @requires !vm.flightRecorder
* @library /test/lib
* @modules java.base/jdk.internal.misc
* @run driver/timeout=180 gc.stress.TestStressG1Humongous 16 5 2.1 120
*/

/*
* @test
* @requires vm.gc.G1
* @requires !vm.flightRecorder
* @library /test/lib
* @modules java.base/jdk.internal.misc
* @run driver/timeout=180 gc.stress.TestStressG1Humongous 32 4 0.6 120
*/

/*
* @test
* @requires vm.gc.G1
* @requires !vm.flightRecorder
* @library /test/lib
* @modules java.base/jdk.internal.misc
* @run driver/timeout=900 gc.stress.TestStressG1Humongous 1 7 0.6 600
*/

import java.util.ArrayList;
Expand All @@ -48,17 +75,19 @@
public class TestStressG1Humongous{

public static void main(String[] args) throws Exception {
if (args.length != 4) {
throw new IllegalArgumentException("Test expects 4 arguments");
}

// Limit heap size on 32-bit platforms
int heapSize = Platform.is32bit() ? 512 : 1024;
// Heap size, region size, threads, humongous size, timeout
run(heapSize, 4, 3, 1.1, 120);
run(heapSize, 16, 5, 2.1, 120);
run(heapSize, 32, 4, 0.6, 120);
run(heapSize, 1, 7, 0.6, 600);
}

private static void run(int heapSize, int regionSize, int threads, double humongousSize, int timeout)
throws Exception {
// Region size, threads, humongous size, and timeout passed as @run arguments
int regionSize = Integer.parseInt(args[0]);
int threads = Integer.parseInt(args[1]);
double humongousSize = Double.parseDouble(args[2]);
int timeout = Integer.parseInt(args[3]);

ArrayList<String> options = new ArrayList<>();
Collections.addAll(options, Utils.getTestJavaOpts());
Collections.addAll(options,
Expand Down

1 comment on commit 2e55190

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.