Skip to content

Commit 63b5bd2

Browse files
committed
Merge branch 'add_idle_test' of github.com:tanvikini/openj9-systemtest into add_idle_test
2 parents ec36c12 + b12b01f commit 63b5bd2

File tree

4 files changed

+64
-12
lines changed

4 files changed

+64
-12
lines changed

openj9.build/makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -534,15 +534,15 @@ test.SharedClasses.SCM23.MultiThreadMultiCL:
534534
echo Target $@ completed
535535
test.IdleBenchMark_MinIdleWaitTime:
536536
echo Running target $@
537-
$(STF_COMMAND) -test=IdleLoadTest -java-args="-XX:IdleTuningMinIdleWaitTime=180 -Xmx1024m -Xjit:verbose={compilePerformance},vlog=jitlog" $(LOG)
537+
$(STF_COMMAND) -test=IdleLoadTest -test-args="variation=MinIdleWaitTime" $(LOG)
538538
echo Target $@ completed
539539
test.IdleBenchMark_GcOnIdle:
540540
echo Running target $@
541-
$(STF_COMMAND) -test=IdleLoadTest -java-args="-XX:+IdleTuningGcOnIdle -Xtune:virtualized -XX:IdleTuningMinIdleWaitTime=120 -Xmx1024m -verbose:gc -Xverbosegclog:gc.verbose -Xjit:verbose={compilePerformance},vlog=jitlog" $(LOG)
541+
$(STF_COMMAND) -test=IdleLoadTest -test-args="variation=GcOnIdle" $(LOG)
542542
echo Target $@ completed
543543
test.IdleBenchMark_CompactOnIdle:
544544
echo Running target $@
545-
$(STF_COMMAND) -test=IdleLoadTest -java-args="-XX:+IdleTuningCompactOnIdle -Xtune:virtualized -XX:IdleTuningMinIdleWaitTime=120 -Xmx1024m -verbose:gc -Xverbosegclog:gc.verbose -Xjit:verbose={compilePerformance},vlog=jitlog" $(LOG)
545+
$(STF_COMMAND) -test=IdleLoadTest -test-args="variation=CompactOnIdle" $(LOG)
546546
echo Target $@ completed
547547

548548
help:

openj9.test.idle/docs/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
openj9.test.idle
2+
- This project contains a stress version of the Idle Micro Benchmark test which aims to test the Idle detection and management feature available in J9 vm. For more information on the feature and related -XX JVM options, visit : https://www.ibm.com/support/knowledgecenter/SSYKE2_8.0.0/com.ibm.java.lnx.80.doc/diag/appendixes/cmdline/commands_jvm_xx.html.
3+
- The test has been written to have alternating active and idle cycles.
4+
- Active cycles are periods of time when the test will perform CPU and Memory Intensive operations to consume CPU cycles and Heap Memory.
5+
- Idle cycles are longer periods of time where the test sleeps/ performs no activity.
6+
- Idle detection and management are enabled/disabled via newly added JVM options.
7+
- The Idle detection feature is available on all platforms whereas Idle management feature is supported only on Linux x86 platforms.
8+
- The test exercises the newly added JVM options and checks if they behave as expected under stress conditions.
9+
10+
- There are 3 variations to this test
11+
12+
1. MinIdleWaitTime
13+
- Tests the -XX:IdleTuningMinIdleWaitTime option. This is the minimum amount of time the application needs to be idle to be detected as Idle.
14+
- Applicable on all platforms.
15+
- Uses the following Java arguments while running the test
16+
-XX:IdleTuningMinIdleWaitTime=180 -Xmx1024m -Xjit:verbose={compilePerformance},vlog=jitlog
17+
18+
2. GcOnIdle
19+
- Tests the -XX:+IdleTuningGcOnIdle and when enabled, GC kicks in during the Idle cycle and reduces the footprint of the application.
20+
- Applicable only on Linux_x86-32 and Linux_x86-64 platforms as of now.
21+
- Uses the following JVM arguments while running the test
22+
-XX:+IdleTuningGcOnIdle -Xtune:virtualized -XX:IdleTuningMinIdleWaitTime=120 -Xmx1024m -verbose:gc -Xverbosegclog:gc.verbose -Xjit:verbose={compilePerformance},vlog=jitlog" $(LOG)
23+
24+
3. CompactOnIdle
25+
- Tests the -XX:+IdleTuningCompactOnIdle and when enabled, GC performs compaction on the heap during idle cycle to create contiguious free memory spaces for newer allocations.
26+
- Applicable only on Linux_x86-32 and Linux_x86-64 platforms as of now.
27+
- Uses the following JVM arguments while running the test
28+
-XX:+IdleTuningCompactOnIdle -Xtune:virtualized -XX:IdleTuningMinIdleWaitTime=120 -Xmx1024m -verbose:gc -Xverbosegclog:gc.verbose -Xjit:verbose={compilePerformance},vlog=jitlog
29+

openj9.test.idle/src/test.idle/net/openj9/test/IdleMicroBenchmark.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ public static void main(String args[]) throws MalformedObjectNameException, IOEx
167167
try {
168168
IdleMicroBenchmark imbm1 = new IdleMicroBenchmark();
169169
long memoryLimitInBytes = memoryLimit * 1024 * 1024;
170+
//multiply sleepTime by 1000L to convert seconds to milliseconds as it is passed to Thread.sleep();
170171
sleepTime = sleepTime * 1000L;
171172
System.setProperty("isIdle", "false");
172173

@@ -219,7 +220,7 @@ public static void main(String args[]) throws MalformedObjectNameException, IOEx
219220
void induceCombinedLoad(int threads, int interval, int workloadTypeNum, long runFor, long memoryLimit, ExecutorService executor) {
220221

221222
List<Future<Long>> combinedWorkerList = new ArrayList<Future<Long>>();
222-
long stopRunning = System.currentTimeMillis() + 1000L * runFor;
223+
long stopRunning = System.currentTimeMillis() + 1000L * runFor;
223224
java.lang.management.MemoryMXBean membean = ManagementFactory.getMemoryMXBean();
224225
long heapInBytes = 0;
225226
int iter = 1;
@@ -264,12 +265,6 @@ void induceCombinedLoad(int threads, int interval, int workloadTypeNum, long run
264265

265266
System.out.println("CombinedLoad Load: Iteration: " + iter + ": Complete. Time: " + timeDiff + " Heap: " + heapInBytes);
266267

267-
try {
268-
//Thread.sleep(10000);
269-
} catch (Exception e) {
270-
e.printStackTrace();
271-
System.exit(1);
272-
}
273268
}
274269

275270
iter++;

openj9.test.load/src/test.load/net/openj9/stf/IdleLoadTest.java

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import net.adoptopenjdk.stf.extensions.core.StfCoreExtension;
2626
import net.adoptopenjdk.stf.extensions.core.StfCoreExtension.Echo;
2727
import net.adoptopenjdk.stf.plugin.interfaces.StfPluginInterface;
28+
import net.adoptopenjdk.stf.environment.StfTestArguments;
2829
import net.adoptopenjdk.stf.processes.ExpectedOutcome;
2930
import net.adoptopenjdk.stf.processes.definitions.JavaProcessDefinition;
3031
import net.adoptopenjdk.stf.processes.definitions.LoadTestProcessDefinition;
@@ -36,12 +37,32 @@
3637
* test cases from the test.util project.
3738
*/
3839
public class IdleLoadTest implements StfPluginInterface {
40+
String jvmOptions;
41+
String testType;
3942
public void help(HelpTextGenerator help) throws StfException {
40-
help.outputSection("IdleLoadTest runs a workload of Java.util related tests.");
43+
help.outputSection("IdleLoadTest runs a CPU and memory intensive workloads to test working of the Idle tuning feature.");
4144
help.outputText("");
4245
}
4346

4447
public void pluginInit(StfCoreExtension test) throws StfException {
48+
StfTestArguments testArgs = test.env().getTestProperties("variation=[MinIdleWaitTime]");
49+
testType = testArgs.get("variation");
50+
if(testType.equals("MinIdleWaitTime")) {
51+
jvmOptions = "-XX:IdleTuningMinIdleWaitTime=180 -Xmx1024m -Xjit:verbose={compilePerformance},vlog=jitlog";
52+
}
53+
else {
54+
String platform = test.env().getPlatform();
55+
if ( !platform.equals("linux_x86-64") && !platform.equals("linux_x86-32") ) {
56+
throw new StfException("This test is only applible on Linux_x86 platforms.");
57+
}
58+
if ( testType.equals("GcOnIdle") ) {
59+
jvmOptions = "-XX:+IdleTuningGcOnIdle -Xtune:virtualized -XX:IdleTuningMinIdleWaitTime=120 -Xmx1024m -verbose:gc -Xverbosegclog:gc.verbose -Xjit:verbose={compilePerformance},vlog=jitlog";
60+
}
61+
if ( testType.equals("CompactOnIdle") ) {
62+
jvmOptions = "-XX:+IdleTuningCompactOnIdle -Xtune:virtualized -XX:IdleTuningMinIdleWaitTime=120 -Xmx1024m -verbose:gc -Xverbosegclog:gc.verbose -Xjit:verbose={compilePerformance},vlog=jitlog";
63+
}
64+
}
65+
4566
}
4667

4768
public void setUp(StfCoreExtension test) throws StfException {
@@ -57,6 +78,7 @@ public void execute(StfCoreExtension test) throws StfException {
5778
int cpuCount = Runtime.getRuntime().availableProcessors();
5879

5980
LoadTestProcessDefinition loadTestInvocation = test.createLoadTestSpecification()
81+
.addJvmOption(jvmOptions)
6082
.addPrereqJarToClasspath(JavaProcessDefinition.JarId.JUNIT)
6183
.addPrereqJarToClasspath(JavaProcessDefinition.JarId.HAMCREST)
6284
.addProjectToClasspath("openj9.test.idle")
@@ -69,12 +91,18 @@ public void execute(StfCoreExtension test) throws StfException {
6991
// Copying the images folder to the results dir
7092
test.doCpDir("Copy pics to results dir", test.env().findTestDirectory("openj9.test.idle").childDirectory("src/test.idle/net/openj9/test/images"), test.env().getResultsDir().childDirectory("images"));
7193

94+
7295
test.doRunForegroundProcess("Run idle load test", "ILT", Echo.ECHO_ON,
7396
ExpectedOutcome.cleanRun().within("1h30m"),
7497
loadTestInvocation);
7598

7699
if ( test.getJavaArgs(test.env().primaryJvm()).contains("-verbose:gc") || test.env().getResultsDir().childFile("gc.verbose").asJavaFile().exists() ) {
77-
test.doCountFileMatches("Looking for string release free pages in gc logs", test.env().getResultsDir().childFile("gc.verbose"), numOfIterations, "type=\"release free pages\"");
100+
if ( testType.equals("GcOnIdle") ) {
101+
test.doCountFileMatches("Looking for string release free pages in gc logs", test.env().getResultsDir().childFile("gc.verbose"), numOfIterations, "type=\"release free pages\"");
102+
}
103+
if ( testType.equals("CompactOnIdle") ) {
104+
test.doCountFileMatches("Looking for string sys-start reason=vm idle in gc logs", test.env().getResultsDir().childFile("gc.verbose"), 1, "sys-start reason=\"vm idle\"");
105+
}
78106
}
79107
}
80108

0 commit comments

Comments
 (0)