-
-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding the Idle Micro Benchmark into the openj9-systemtest repo. #13
Open
tanvikini
wants to merge
5
commits into
adoptium:master
Choose a base branch
from
tanvikini:add_idle_test
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b12b01f
Adding the Idle Micro Benchmark into the openj9-systemtest repo.
tanvikini ec36c12
Adding the Idle Micro Benchmark into the openj9-systemtest repo.
tanvikini 68d9719
Merge branch 'add_idle_test' of github.com:tanvikini/openj9-systemtes…
tanvikini 8821696
Merge branch 'master' into add_idle_test
tanvikini 73373d3
Update makefile
tanvikini File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
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 | ||
--> | ||
|
||
<project name="openj9.test.idle" default="build"> | ||
|
||
<!-- Set default for source_root. --> | ||
<property name="source_root" location="../"/> | ||
|
||
<!-- Set default for STF location. --> | ||
<!-- Assumes source repositories are checked out under a common root - e.g. and the repository | ||
has been built in-situ - i.e. | ||
stf repository: /home/userid/git/stf | ||
java.svt repository: /home/userid/git/java.svt | ||
If the stf repository has been cloned or built to a different location, the stf_root property | ||
must be set on the command line - e.g. -Dstf_root=/my_stf_build_dir | ||
--> | ||
<property name="stf_root" location="${source_root}/../stf"/> | ||
|
||
<!-- Import settings used by multiple projects. --> | ||
<import file="${source_root}/openj9.build/include/top.xml"/> | ||
|
||
<!-- For modularity you need a directory above the package structure to hold the module.java file --> | ||
<property name="module" value="test.idle" /> | ||
<property name="src_dir" value="src/${module}" /> | ||
<property name="bin_dir" value="bin" /> | ||
|
||
<property name="jar_file" value="${bin_dir}/${module}.jar" /> | ||
|
||
<!-- We need junit and stf to compile this project. --> | ||
<path id="project.class.path"> | ||
<path refid="junit.class.path" /> | ||
<path refid="stf.class.path" /> | ||
</path> | ||
|
||
<!-- Projects which need to be built before this one. --> | ||
<!-- dir must be set on the ant task otherwise the basedir property is not set to a new value in the subant task. --> | ||
<target name="build-dependencies"> | ||
<!-- <ant antfile="${stf_root}/stf.build/build.xml" dir="${stf_root}/stf.build" inheritAll="false"/> --> | ||
</target> | ||
|
||
<target name="build" depends="build-no-natives, build-natives"> | ||
</target> | ||
|
||
<target name="build-no-natives" depends="build-dependencies, check-prereqs, build-archives"> | ||
</target> | ||
|
||
<target name="build-natives"> | ||
</target> | ||
|
||
<target name="build-archives" depends="build-jar"> | ||
</target> | ||
|
||
<target name="build-jar" depends="build-java, create-bin-dir"> | ||
<jar destfile="${jar_file}"> | ||
<fileset dir="${bin_dir}" includes="**/*.class" /> | ||
</jar> | ||
</target> | ||
|
||
<target name="build-java" depends="check-prereqs, create-bin-dir"> | ||
<!-- | ||
The Ant javac task only checks time dependencies between .java files and their .class files, | ||
so fails to recompile in situations such as the signatures of a dependent method changing. | ||
The depend target checks the dependencies and deletes any .class files older than the files | ||
which depend on them, thereby ensuring recompilation. | ||
--> | ||
<depend srcdir="${src_dir}" destdir="${bin_dir}" classpathref="project.class.path"> | ||
<include name="**/*.java"/> | ||
</depend> | ||
<javac srcdir="${src_dir}" | ||
destdir="${bin_dir}" | ||
fork="true" | ||
executable="${java8_compiler}" | ||
debug="true" | ||
classpathref="project.class.path" | ||
encoding="UTF-8" | ||
includeantruntime="false" | ||
failonerror="true"> | ||
<include name="**/*.java"/> | ||
</javac> | ||
</target> | ||
|
||
<target name="create-bin-dir"> | ||
<mkdir dir="${bin_dir}"/> | ||
</target> | ||
|
||
<target name="clean"> | ||
<delete dir="${bin_dir}"/> | ||
</target> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
159 changes: 159 additions & 0 deletions
159
openj9.test.idle/src/test.idle/net/openj9/test/CombinedLoad.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<Long> | ||
{ | ||
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; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a backslash on this line