diff --git a/openj9.build/build.xml b/openj9.build/build.xml index 7b153c4..81a1d12 100644 --- a/openj9.build/build.xml +++ b/openj9.build/build.xml @@ -21,7 +21,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-excepti --> - @@ -52,6 +51,7 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-excepti + diff --git a/openj9.build/makefile b/openj9.build/makefile index 7d0b081..856d574 100644 --- a/openj9.build/makefile +++ b/openj9.build/makefile @@ -416,6 +416,12 @@ test.SharedClasses.SCM23.MultiThread \ test.SharedClasses.SCM23.MultiThreadMultiCL SHARED_CLASSES_TESTS:=$(filter-out $(EXCLUDE),$(SHARED_CLASSES_TESTS)) + +IDLE_TESTS:=test.IdleBenchMark_MinIdleWaitTime \ +test.IdleBenchMark_GcOnIdle \ +test.IdleBenchMark_CompactOnIdle +IDLE_TESTS:=$(filter-out $(EXCLUDE),$(IDLE_TESTS)) + JLM_TESTS:=test.TestIBMJlmLocal \ test.TestIBMJlmRemoteClassAuth \ test.TestIBMJlmRemoteClassNoAuth \ @@ -423,12 +429,15 @@ test.TestIBMJlmRemoteMemoryAuth \ test.TestIBMJlmRemoteMemoryNoAuth JLM_TESTS:=$(filter-out $(EXCLUDE),$(JLM_TESTS)) + TEST_TARGETS:=test.list \ test.help \ $(DAA_TESTS) \ $(GC_TESTS) \ $(SHARED_CLASSES_TESTS) \ +$(IDLE_TESTS) \ $(JLM_TESTS) + TEST_TARGETS:=$(filter-out $(EXCLUDE),$(TEST_TARGETS)) .PHONY: build configure clean refresh_source test $(TEST_TARGETS) @@ -455,6 +464,7 @@ test: $(TEST_TARGETS) test.daa: $(DAA_TESTS) test.gc: $(GC_TESTS) test.SharedClasses: $(SHARED_CLASSES_TESTS) +test.idle: $(IDLE_TESTS) test.jlm: $(JLM_TESTS) test.list: @@ -541,6 +551,18 @@ test.SharedClasses.SCM23.MultiThreadMultiCL: echo Running target $@ $(STF_COMMAND) -test=SharedClasses -test-args="sharedClassMode=SCM23,sharedClassTest=MultiThreadMultiCL" $(LOG) echo Target $@ completed +test.IdleBenchMark_MinIdleWaitTime: + echo Running target $@ + $(STF_COMMAND) -test=IdleLoadTest -test-args="variation=MinIdleWaitTime" $(LOG) + echo Target $@ completed +test.IdleBenchMark_GcOnIdle: + echo Running target $@ + $(STF_COMMAND) -test=IdleLoadTest -test-args="variation=GcOnIdle" $(LOG) + echo Target $@ completed +test.IdleBenchMark_CompactOnIdle: + echo Running target $@ + $(STF_COMMAND) -test=IdleLoadTest -test-args="variation=CompactOnIdle" $(LOG) + echo Target $@ completed test.TestIBMJlmLocal: echo Running target $@ $(STF_COMMAND) -test=TestIBMJlmLocal $(LOG) @@ -562,9 +584,10 @@ test.TestIBMJlmRemoteMemoryNoAuth: $(STF_COMMAND) -test=TestIBMJlmRemoteMemoryNoAuth $(LOG) echo Target $@ completed + help: @echo make or make build: Builds openj9-systemtest projects @echo make test: Runs all openj9-systemtest tests @echo make $(TEST_TARGETS): Runs all openj9-systemtest tests @echo make test.xxxx: Runs individual test xxxx - \ No newline at end of file + diff --git a/openj9.test.idle/build.xml b/openj9.test.idle/build.xml new file mode 100644 index 0000000..0755920 --- /dev/null +++ b/openj9.test.idle/build.xml @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/openj9.test.idle/docs/README.md b/openj9.test.idle/docs/README.md new file mode 100644 index 0000000..d2d1857 --- /dev/null +++ b/openj9.test.idle/docs/README.md @@ -0,0 +1,29 @@ +openj9.test.idle +- 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. +- The test has been written to have alternating active and idle cycles. +- Active cycles are periods of time when the test will perform CPU and Memory Intensive operations to consume CPU cycles and Heap Memory. +- Idle cycles are longer periods of time where the test sleeps/ performs no activity. +- Idle detection and management are enabled/disabled via newly added JVM options. +- The Idle detection feature is available on all platforms whereas Idle management feature is supported only on Linux x86 platforms. +- The test exercises the newly added JVM options and checks if they behave as expected under stress conditions. + +- There are 3 variations to this test + +1. MinIdleWaitTime +- Tests the -XX:IdleTuningMinIdleWaitTime option. This is the minimum amount of time the application needs to be idle to be detected as Idle. +- Applicable on all platforms. +- Uses the following Java arguments while running the test + -XX:IdleTuningMinIdleWaitTime=180 -Xmx1024m -Xjit:verbose={compilePerformance},vlog=jitlog + +2. GcOnIdle +- Tests the -XX:+IdleTuningGcOnIdle and when enabled, GC kicks in during the Idle cycle and reduces the footprint of the application. +- Applicable only on Linux_x86-32 and Linux_x86-64 platforms as of now. +- Uses the following JVM arguments while running the test + -XX:+IdleTuningGcOnIdle -Xtune:virtualized -XX:IdleTuningMinIdleWaitTime=120 -Xmx1024m -verbose:gc -Xverbosegclog:gc.verbose -Xjit:verbose={compilePerformance},vlog=jitlog" $(LOG) + +3. CompactOnIdle +- 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. +- Applicable only on Linux_x86-32 and Linux_x86-64 platforms as of now. +- Uses the following JVM arguments while running the test + -XX:+IdleTuningCompactOnIdle -Xtune:virtualized -XX:IdleTuningMinIdleWaitTime=120 -Xmx1024m -verbose:gc -Xverbosegclog:gc.verbose -Xjit:verbose={compilePerformance},vlog=jitlog + diff --git a/openj9.test.idle/src/test.idle/net/openj9/test/CombinedLoad.java b/openj9.test.idle/src/test.idle/net/openj9/test/CombinedLoad.java new file mode 100644 index 0000000..d9275ed --- /dev/null +++ b/openj9.test.idle/src/test.idle/net/openj9/test/CombinedLoad.java @@ -0,0 +1,159 @@ +/******************************************************************************* +* Copyright (c) 2017 IBM Corp. +* +* This program and the accompanying materials are made available under the +* terms of the Eclipse Public License 2.0 which accompanies this distribution +* and is available at http://eclipse.org/legal/epl-2.0 or the Apache License, +* Version 2.0 which accompanies this distribution and is available at +* https://www.apache.org/licenses/LICENSE-2.0. +* +* This Source Code may also be made available under the following Secondary +* Licenses when the conditions for such availability set forth in the +* Eclipse Public License, v. 2.0 are satisfied: GNU General Public License, +* version 2 with the GNU Classpath Exception [1] and GNU General Public License, +* version 2 with the OpenJDK Assembly Exception [2]. +* +* [1] https://www.gnu.org/software/classpath/license.html +* [2] http://openjdk.java.net/legal/assembly-exception.html +* +* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +*******************************************************************************/ +package net.openj9.test; + +import java.io.File; +import java.io.IOException; +import java.util.Random; +import java.util.concurrent.Callable; +import java.util.Calendar; +import java.util.Date; +import java.awt.image.BufferedImage; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import javax.imageio.ImageIO; +import java.lang.management.ManagementFactory; + +import net.openj9.test.LargeObj; + + +public class CombinedLoad implements Callable +{ + private int workloadImageNumber; + private long threadId; + private long busyTime = 0; + private long memoryLimitInBytes = 0L; + private final int numObjs = 10000; + private long numtrans = 0; + + public CombinedLoad(int workloadTypeNum, long mSec, long memLimitInBytes) { + workloadImageNumber = workloadTypeNum; + busyTime = mSec * 1000000L ; + memoryLimitInBytes = memLimitInBytes; + } + + public long getTrans() { + return numtrans; + } + + public void resetTrans() { + numtrans = 0; + } + + public long getThreadId() { + return threadId; + } + + public Long call() { + Date dateobj; + Calendar calobj; + long startTime = 0; + long currTime = 0; + float diff = 0; + LargeObj[] memoryFill = new LargeObj[numObjs]; + DateFormat df = new SimpleDateFormat("dd/MM/yy HH:mm:ss"); + java.lang.management.MemoryMXBean membean = ManagementFactory.getMemoryMXBean(); + long heapInBytes = 0L; + + threadId = Thread.currentThread().getId(); + startTime = System.nanoTime(); + System.out.println("Test Application: CPU: Thread: " + threadId + " busy looping start"); + do { + File iFile; + BufferedImage image; + + if ( System.getProperty("isIdle").equals("true") ) { + System.out.println("App is going IDLE.. Stop working.. zzzzzz"); + break; + } + + // This loop tries to wake up JIT by running for 30 secs + long busyTime = 30000 * 1000000L; + while ((System.nanoTime() - startTime) < busyTime) { + Random rand = new Random(); + double result = java.lang.Math.log(rand.nextDouble()); + } + + for (int i = 0; i < 10000 ; i++) { + + dateobj = new Date(); + calobj = Calendar.getInstance(); + currTime = System.nanoTime(); + diff = (float) ((float) (currTime - startTime) / (float) 1000000); + for (int j = 0; j < numObjs; j++) { + memoryFill[j] = new LargeObj(diff); + } + + if (diff == 1.000000 || diff == 2.000000 || diff == 3.000000 || diff == 4.000000 || diff == 5.000000) { + System.out.println("CurrTime: " + currTime + " startTime: " + startTime + " busyTime: " + busyTime + " diff: " + diff); + } + if (diff > 6) { + break; + } + } + + try { + if( System.getProperty("isIdle").equals("true") ) { + System.out.println("App is going IDLE.. Stop working.. zzzzzz"); + break; + } + switch(workloadImageNumber) { + case 0: + iFile = new File("images/1KbImage.jpg"); + break; + case 1: + iFile = new File("images/500KbImage.jpg"); + break; + case 2: + iFile = new File("images/1MbImage.jpg"); + break; + case 3: + iFile = new File("images/1point5MbImage.jpg"); + break; + case 4: + iFile = new File("images/2MbImage.jpg"); + break; + case 5: + iFile = new File("images/5MbImage.jpg"); + break; + case 6: + iFile = new File("images/15point5MbImage.png"); + break; + default : + iFile = new File("images/1MbImage.jpg"); + } + image = ImageIO.read(iFile); + }catch (IOException e) { + System.err.println("Error reading image file\n"); + } + + iFile = null; + image = null; + currTime = System.nanoTime(); + numtrans++; + heapInBytes = membean.getHeapMemoryUsage().getUsed(); + + } while((currTime - startTime) < busyTime && heapInBytes <= memoryLimitInBytes); + + System.out.println("Test Application: Thread: " + threadId + " busy looping done; Num-trans: " + numtrans); + return threadId; + } +} diff --git a/openj9.test.idle/src/test.idle/net/openj9/test/IdleMicroBenchmark.java b/openj9.test.idle/src/test.idle/net/openj9/test/IdleMicroBenchmark.java new file mode 100644 index 0000000..9c0980c --- /dev/null +++ b/openj9.test.idle/src/test.idle/net/openj9/test/IdleMicroBenchmark.java @@ -0,0 +1,294 @@ +/******************************************************************************* +* Copyright (c) 2017 IBM Corp. +* +* This program and the accompanying materials are made available under the +* terms of the Eclipse Public License 2.0 which accompanies this distribution +* and is available at http://eclipse.org/legal/epl-2.0 or the Apache License, +* Version 2.0 which accompanies this distribution and is available at +* https://www.apache.org/licenses/LICENSE-2.0. +* +* This Source Code may also be made available under the following Secondary +* Licenses when the conditions for such availability set forth in the +* Eclipse Public License, v. 2.0 are satisfied: GNU General Public License, +* version 2 with the GNU Classpath Exception [1] and GNU General Public License, +* version 2 with the OpenJDK Assembly Exception [2]. +* +* [1] https://www.gnu.org/software/classpath/license.html +* [2] http://openjdk.java.net/legal/assembly-exception.html +* +* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +*******************************************************************************/ +package net.openj9.test; + +import java.io.IOException; +import java.lang.management.ManagementFactory; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.Date; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import javax.management.MalformedObjectNameException; + + +/** + * Tests implement different kinds of load with different CPU/Memory Usages to + * observe the gc usage with and without Idle-detection enabled in the JVM. + * + * Parameter to be passed to the command line as are follows : + * 1} --time = (Default set to 300 seconds) The time for which the given workload + * must run. + * + * 2} --memoryLimit = (Default set to 512 MB). The heap memory limit passed + * to the test. + * + * 3} --workload = (Default set to 'image'). The kind of workload which + * needs to run. Option values can be transactional/image/spike. + * + * 4} --threadcount = (Default set to 10). The number of threads running the given + * workload. + * + * 5} --printstats = (Default set to true). Valid values are true/false. Used + * for printing thread related information after running the workload. + * + * 6} --iterations = (Default set to 3). Number of idle/active cycles to be run. + * + * 7} --warmup = (Default set to 120 seconds). Amount of time for which the + * warm up cycle should last before running the actual workload. + * + * 8} --idletime = (Default set to 600 sec). The duration for long idle + * between active cycles. + * + */ + +public class IdleMicroBenchmark { + + private static int busyInterval = 5000; + private static int nIterations = 1; + private static boolean doWarmUp = false; + + public void runTest(String testArg) throws MalformedObjectNameException, IOException { + String[] testArgs = new String[]{testArg}; + new IdleMicroBenchmark(); + IdleMicroBenchmark.main(testArgs); + } + + public static void main(String args[]) throws MalformedObjectNameException, IOException + { + int nThreads = 0; + long runFor = 60L; // This is the active cycle and is currently set to one minute + long sleepTime = 300L; // This is the idle cycle and is currently set to five minutes + int memoryLimit = 512; + String workloadType = "image"; + int workloadTypeNum = 3; + long warmUpFor = 30L; + int nWarmUpThreads = 2; + ExecutorService executor = null; + + System.out.println(" ----------------------------------------------------------"); + System.out.println(" Starting the IdleMicroBenchmark test........"); + System.out.println(" ----------------------------------------------------------"); + System.out.println(""); + System.out.println(""); + + for (int i = 0; i < args.length; i++) { + // Parsing command line options + String option = args[i]; + String optionName = null; + String optionValue = null; + if (option.indexOf("=") == -1 ) { + optionName = option; + } + else { + String parts[] = option.split("="); + optionName = parts[0]; + optionValue = parts[1]; + } + + if (optionName.equals("--help")) { + help(); + } + if (optionName.equals("--workload")) { + if (optionValue.equals("transactional") || optionValue.equals("image") || optionValue.equals("spike")) { + workloadType = optionValue; + if (optionValue.equals("transactional")) { + nThreads = 8; + workloadTypeNum = 1; + } + if (optionValue.equals("image")) { + nThreads = 5; + workloadTypeNum = 3; + } + if (optionValue.equals("spike")) { + nThreads = 3; + workloadTypeNum = 0; + } + } else { + System.out.println("Correct usage is \n '--workload=transactional' for a transactional workload\n and\n '--workload=image' for a heavier memory intensive workload and "); + System.out.println("workload=spike for a workload which mimics a sudden spike in the number of transactions in a short period of time."); + System.exit(1); + } + } + + //Time is in seconds + if (optionName.equals("--time")) { + runFor = Long.parseLong(optionValue); + } + + //Memory in MB + if (optionName.equals("--memoryLimit")) { + memoryLimit = Integer.parseInt(optionValue); + } + + if (optionName.equals("--threadcount")) { + nThreads = Integer.parseInt(optionValue); + } + + if (optionName.equals("--iterations")) { + nIterations = Integer.parseInt(optionValue); + } + + if (optionName.equals("--idletime")) { + sleepTime = Integer.parseInt(optionValue); + } + + if (optionName.equals("--warmup")) { + warmUpFor = Long.parseLong(optionValue); + if (warmUpFor == 0) { + doWarmUp = false; + } + } + } //finish parsing command line + + try { + IdleMicroBenchmark imbm1 = new IdleMicroBenchmark(); + long memoryLimitInBytes = memoryLimit * 1024 * 1024; + //multiply sleepTime by 1000L to convert seconds to milliseconds as it is passed to Thread.sleep(); + sleepTime = sleepTime * 1000L; + System.setProperty("isIdle", "false"); + + executor = Executors.newFixedThreadPool(nThreads); + System.out.println(" ========= TEST DETAILS =========\n\n"); + System.out.println(" TIME LIMIT = " + runFor + " SECONDS \n MEMORY LIMIT = " + memoryLimit + " MB" ); + System.out.println(" WORKLOAD TYPE = " + workloadType + "\n NUMBER OF THREADS = " + nThreads + "\n"); + System.out.println(" NUMBER OF ITERATIONS = " + nIterations + "\n IDLE TIME = " + sleepTime + " MSEC\n\n" ); + System.out.println(" =================================\n\n"); + + if (doWarmUp == true) { + System.out.println("\n\nMain : ======================== Application Warming up =========================\n\n"); + imbm1.induceCombinedLoad(nWarmUpThreads, busyInterval, workloadTypeNum, warmUpFor, memoryLimitInBytes, executor); + System.out.println("\n\nMain : ======================== Application Warm Up Done ========================\n\n"); + } + + + for (int i = 0; i < nIterations ; i++) { + DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); + System.out.println(dateFormat.format(new Date()) + "Main: =============== Starting: Application inducing load ==============="); + imbm1.induceCombinedLoad(nThreads, busyInterval, workloadTypeNum, runFor, memoryLimitInBytes, executor); + System.out.println(dateFormat.format(new Date()) + "Main: =============== Complete: Application inducing load ==============="); + System.out.println(dateFormat.format(new Date()) + "Main: =============== Starting: Application Long Idle ==============="); + System.setProperty("isIdle", "true"); + Thread.sleep(sleepTime); + System.setProperty("isIdle", "false"); + System.out.println(dateFormat.format(new Date()) + "Main: =============== Complete: Application Long Idle ==============="); + } + + } catch (Exception e) { + System.out.println("Exception occurred ."); + e.printStackTrace(); + System.exit(1); + } finally { + } + + executor.shutdown(); + // Wait until all threads are terminated + while (!executor.isTerminated()) { + } + + } //main function ends here + + //*****************************************Implementing higher level function here ***************************************** + + /** + *induceCombinedLoad() - Induces a workload consisting of both CPU as well as Memory Intensive operations. + *Implements the executor submit interface. + */ + void induceCombinedLoad(int threads, int interval, int workloadTypeNum, long runFor, long memoryLimit, ExecutorService executor) { + + List> combinedWorkerList = new ArrayList>(); + long stopRunning = System.currentTimeMillis() + 1000L * runFor; + java.lang.management.MemoryMXBean membean = ManagementFactory.getMemoryMXBean(); + long heapInBytes = 0; + int iter = 1; + long currTime = 0; + long startTime = 0; + long timeDiff = 0; + CombinedLoad combinedList[] = new CombinedLoad[threads]; + + for (int i = 0; i < threads; i++) { + combinedList[i] = new CombinedLoad(workloadTypeNum, interval, memoryLimit); + } + + do { + if ( System.getProperty("isIdle").equals("true") ) { + System.out.println("App is going IDLE.. Stop creating tasks.. zzzzzz"); + break; + } + + if (heapInBytes < memoryLimit) { + System.out.println("CombinedLoad Load: Iteration: " + iter + ": Starting: ===== Application Active ====="); + startTime = System.currentTimeMillis(); + for (int i = 0; i < threads; i++) { + Callable combinedWorker = combinedList[i]; + Future res = executor.submit(combinedWorker); + combinedWorkerList.add(res); + } + + for (Future future : combinedWorkerList) { + try { + System.out.println("Test Application: Thread: <" + future.get() + "> finished"); + } catch (InterruptedException e) { + e.printStackTrace(); + } catch (ExecutionException e) { + e.printStackTrace(); + } + } + combinedWorkerList.clear(); + + heapInBytes = membean.getHeapMemoryUsage().getUsed(); + currTime = System.currentTimeMillis(); + timeDiff = currTime - startTime; + + System.out.println("CombinedLoad Load: Iteration: " + iter + ": Complete. Time: " + timeDiff + " Heap: " + heapInBytes); + + } + + iter++; + + } while ( System.currentTimeMillis() < stopRunning && heapInBytes < memoryLimit ); + + for (int i = 0; i < threads ; i++) { + System.out.println(" Index : "+ i +"ThreadId :" + combinedList[i].getThreadId() + " Transactions : " + combinedList[i].getTrans() + "\n"); + combinedList[i].resetTrans(); + } + + } + + private static void help() + { + System.out.println(" Parameters to be passed to the command line as are follows :\n" + + "1} --time = (Default set to 300 seconds) The time for which the given workload must run.\n" + + "2} --memoryLimit = (Default set to 512 MB). The heap memory limit passed to the test.\n" + + "3} --workload = (Default set to 'image'). The kind of workload which needs to run. Option values can be transactional/image/spike.\n" + + "4} --threadcount = (Default set to 10). The number of threads running the given workload.\n" + + "5} --printstats = (Default set to true). Valid values are true/false. Used for printing thread related information after running the workload.\n" + + "6} --iterations = (Default set to 3). Number of idle/active cycles to be run.\n" + + "7} --warmup = (Default set to 120 seconds). Amount of time for which the warm up cycle should last before running the actual workload.\n" + + "8} --idletime = (Default set to 300 sec). The duration for long idle between active cycles.\n"); + System.exit(1); + } +} diff --git a/openj9.test.idle/src/test.idle/net/openj9/test/LargeObj.java b/openj9.test.idle/src/test.idle/net/openj9/test/LargeObj.java new file mode 100644 index 0000000..0a42b50 --- /dev/null +++ b/openj9.test.idle/src/test.idle/net/openj9/test/LargeObj.java @@ -0,0 +1,39 @@ +/******************************************************************************* +* Copyright (c) 2017 IBM Corp. +* +* This program and the accompanying materials are made available under the +* terms of the Eclipse Public License 2.0 which accompanies this distribution +* and is available at http://eclipse.org/legal/epl-2.0 or the Apache License, +* Version 2.0 which accompanies this distribution and is available at +* https://www.apache.org/licenses/LICENSE-2.0. +* +* This Source Code may also be made available under the following Secondary +* Licenses when the conditions for such availability set forth in the +* Eclipse Public License, v. 2.0 are satisfied: GNU General Public License, +* version 2 with the GNU Classpath Exception [1] and GNU General Public License, +* version 2 with the OpenJDK Assembly Exception [2]. +* +* [1] https://www.gnu.org/software/classpath/license.html +* [2] http://openjdk.java.net/legal/assembly-exception.html +* +* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +*******************************************************************************/ +package net.openj9.test; + +public class LargeObj { + private float alpha; + private float beta; + private float gamma; + private float delta; + private float epsilon; + private float zeta; + private float eta; + private float theta; + private float iota; + private float kappa; + + public LargeObj (float val) { + alpha = beta = gamma = delta = epsilon = zeta = eta = theta = iota = kappa = val; + } + +} diff --git a/openj9.test.idle/src/test.idle/net/openj9/test/images/15point5MbImage.png b/openj9.test.idle/src/test.idle/net/openj9/test/images/15point5MbImage.png new file mode 100644 index 0000000..17e23c4 Binary files /dev/null and b/openj9.test.idle/src/test.idle/net/openj9/test/images/15point5MbImage.png differ diff --git a/openj9.test.idle/src/test.idle/net/openj9/test/images/1KbImage.jpg b/openj9.test.idle/src/test.idle/net/openj9/test/images/1KbImage.jpg new file mode 100644 index 0000000..1493f74 Binary files /dev/null and b/openj9.test.idle/src/test.idle/net/openj9/test/images/1KbImage.jpg differ diff --git a/openj9.test.idle/src/test.idle/net/openj9/test/images/1MbImage.jpg b/openj9.test.idle/src/test.idle/net/openj9/test/images/1MbImage.jpg new file mode 100644 index 0000000..ec2a216 Binary files /dev/null and b/openj9.test.idle/src/test.idle/net/openj9/test/images/1MbImage.jpg differ diff --git a/openj9.test.idle/src/test.idle/net/openj9/test/images/1point5MbImage.jpg b/openj9.test.idle/src/test.idle/net/openj9/test/images/1point5MbImage.jpg new file mode 100644 index 0000000..9a75634 Binary files /dev/null and b/openj9.test.idle/src/test.idle/net/openj9/test/images/1point5MbImage.jpg differ diff --git a/openj9.test.idle/src/test.idle/net/openj9/test/images/2MbImage.jpg b/openj9.test.idle/src/test.idle/net/openj9/test/images/2MbImage.jpg new file mode 100644 index 0000000..a398fcc Binary files /dev/null and b/openj9.test.idle/src/test.idle/net/openj9/test/images/2MbImage.jpg differ diff --git a/openj9.test.idle/src/test.idle/net/openj9/test/images/500KbImage.jpg b/openj9.test.idle/src/test.idle/net/openj9/test/images/500KbImage.jpg new file mode 100644 index 0000000..d10fde2 Binary files /dev/null and b/openj9.test.idle/src/test.idle/net/openj9/test/images/500KbImage.jpg differ diff --git a/openj9.test.idle/src/test.idle/net/openj9/test/images/5MbImage.jpg b/openj9.test.idle/src/test.idle/net/openj9/test/images/5MbImage.jpg new file mode 100644 index 0000000..582b08a Binary files /dev/null and b/openj9.test.idle/src/test.idle/net/openj9/test/images/5MbImage.jpg differ diff --git a/openj9.test.load/config/inventories/idle/idleTest.xml b/openj9.test.load/config/inventories/idle/idleTest.xml new file mode 100644 index 0000000..94b4961 --- /dev/null +++ b/openj9.test.load/config/inventories/idle/idleTest.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/openj9.test.load/src/test.load/net/openj9/stf/IdleLoadTest.java b/openj9.test.load/src/test.load/net/openj9/stf/IdleLoadTest.java new file mode 100644 index 0000000..32874c1 --- /dev/null +++ b/openj9.test.load/src/test.load/net/openj9/stf/IdleLoadTest.java @@ -0,0 +1,115 @@ +/****************************************************************************** +* Copyright (c) 2017 IBM Corp. +* +* This program and the accompanying materials are made available under the +* terms of the Eclipse Public License 2.0 which accompanies this distribution +* and is available at http://eclipse.org/legal/epl-2.0 or the Apache License, +* Version 2.0 which accompanies this distribution and is available at +* https://www.apache.org/licenses/LICENSE-2.0. +* +* This Source Code may also be made available under the following Secondary +* Licenses when the conditions for such availability set forth in the +* Eclipse Public License, v. 2.0 are satisfied: GNU General Public License, +* version 2 with the GNU Classpath Exception [1] and GNU General Public License, +* version 2 with the OpenJDK Assembly Exception [2]. +* +* [1] https://www.gnu.org/software/classpath/license.html +* [2] http://openjdk.java.net/legal/assembly-exception.html +* +* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 +*******************************************************************************/ + +package net.openj9.stf; + +import net.adoptopenjdk.stf.StfException; +import net.adoptopenjdk.stf.extensions.core.StfCoreExtension; +import net.adoptopenjdk.stf.extensions.core.StfCoreExtension.Echo; +import net.adoptopenjdk.stf.plugin.interfaces.StfPluginInterface; +import net.adoptopenjdk.stf.environment.StfTestArguments; +import net.adoptopenjdk.stf.processes.ExpectedOutcome; +import net.adoptopenjdk.stf.processes.definitions.JavaProcessDefinition; +import net.adoptopenjdk.stf.processes.definitions.LoadTestProcessDefinition; +import net.adoptopenjdk.stf.processes.definitions.SystemProcessDefinition; +import net.adoptopenjdk.stf.runner.modes.HelpTextGenerator; + +/** + * This is a test plugin to run the Idle Microbenchmark as a load test which runs + * workloads from the test.idle project. + */ +public class IdleLoadTest implements StfPluginInterface { + String jvmOptions; + String testType; + public void help(HelpTextGenerator help) throws StfException { + help.outputSection("IdleLoadTest runs a CPU and memory intensive workloads to test working of the Idle tuning feature."); + help.outputText(""); + } + + public void pluginInit(StfCoreExtension test) throws StfException { + StfTestArguments testArgs = test.env().getTestProperties("variation=[MinIdleWaitTime]"); + testType = testArgs.get("variation"); + if(testType.equals("MinIdleWaitTime")) { + jvmOptions = "-XX:IdleTuningMinIdleWaitTime=180 -Xmx1024m -Xjit:verbose={compilePerformance},vlog=jitlog"; + } + else { + String platform = test.env().getPlatform(); + if ( !platform.equals("linux_x86-64") && !platform.equals("linux_x86-32") ) { + throw new StfException("This test is only applible on Linux_x86 platforms."); + } + if ( testType.equals("GcOnIdle") ) { + jvmOptions = "-XX:+IdleTuningGcOnIdle -Xtune:virtualized -XX:IdleTuningMinIdleWaitTime=120 -Xmx1024m -verbose:gc -Xverbosegclog:gc.verbose -Xjit:verbose={compilePerformance},vlog=jitlog"; + } + if ( testType.equals("CompactOnIdle") ) { + jvmOptions = "-XX:+IdleTuningCompactOnIdle -Xtune:virtualized -XX:IdleTuningMinIdleWaitTime=120 -Xmx1024m -verbose:gc -Xverbosegclog:gc.verbose -Xjit:verbose={compilePerformance},vlog=jitlog"; + } + } + + } + + public void setUp(StfCoreExtension test) throws StfException { + } + + public void execute(StfCoreExtension test) throws StfException { + + test.env().verifyUsingIBMJava(); + + String inventoryFile = "/openj9.test.load/config/inventories/idle/idleTest.xml"; + int threadCount = 2; + int numOfIterations = 12; + + // Numbr of iterations reduced to 6 for MinIdleWait time as 12 iterations cause an OOM with -Xmx=1024m + if ( testType.equals("MinIdleWaitTime") ) { + numOfIterations = 6; + } + + LoadTestProcessDefinition loadTestInvocation = test.createLoadTestSpecification() + .addJvmOption(jvmOptions) + .addPrereqJarToClasspath(JavaProcessDefinition.JarId.JUNIT) + .addPrereqJarToClasspath(JavaProcessDefinition.JarId.HAMCREST) + .addProjectToClasspath("openj9.test.idle") + .addSuite("idle") + .setSuiteThreadCount(threadCount) + .setSuiteNumTests(threadCount * numOfIterations) + .setSuiteInventory(inventoryFile) + .setSuiteSequentialSelection(); + + // Copying the images folder to the results dir + 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")); + + + test.doRunForegroundProcess("Run idle load test", "ILT", Echo.ECHO_ON, + ExpectedOutcome.cleanRun().within("1h30m"), + loadTestInvocation); + + if ( test.getJavaArgs(test.env().primaryJvm()).contains("-verbose:gc") || test.env().getResultsDir().childFile("gc.verbose").asJavaFile().exists() ) { + if ( testType.equals("GcOnIdle") ) { + test.doCountFileMatches("Looking for string release free pages in gc logs", test.env().getResultsDir().childFile("gc.verbose"), numOfIterations, "type=\"release free pages\""); + } + if ( testType.equals("CompactOnIdle") ) { + 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\""); + } + } + } + + public void tearDown(StfCoreExtension test) throws StfException { + } +}