Skip to content

Commit

Permalink
Merge pull request #27 from judovana/argsEqualsToVars
Browse files Browse the repository at this point in the history
Enabled duration on cmdline, get rid of jdk_version
  • Loading branch information
judovana authored Mar 5, 2024
2 parents cfc8a17 + 9b922c7 commit 01f9894
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 30 deletions.
21 changes: 11 additions & 10 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Building
--------

You build the churn application using mvn package.
However javac can do just fine, and if no maven is around, the top level run.sh will use it.

Running
-------
Expand All @@ -11,6 +12,7 @@ available in Hotspot/OpenJDK
rung1.sh
runcms.sh
runpar.sh
runparold.sh
runshenandoah.sh
runzgc.sh
runzgcgen.sh
Expand All @@ -26,24 +28,23 @@ the following scripts
rung1-nocoops.sh
runcms-nocoops.sh
runpar-nocoops.sh
runparold-nocoops.sh
runshenandoah-nocoops.sh
runzgc-nocoops.sh
runzgcgen-nocoops.sh

Next to it, there is also top level
run.sh
Which is wrapping above bin/* by more reasonable defaults, and/or allows you to run them all.
Which is wrapping above bin/* by more reasonable defaults, and/or allows you to run them ALL/defaultgc
The top level run.sh can be called as:
run.sh <somegc>
run.sh "<gc1 gc2...>" (note the quotes) which then iterates through selectedGCs.
It accepts: HEAPSIZE=3g ITEMS=250 THREADS=2 DURATION=18000 # 5 hours (in seconds)# COMPUTATIONS=64 BLOCKS=16 env variables
Insted of via arguments, you may configure GC via variables: of OTOOL_garbageCollector and OTOOL_JDK_VERSION ; those, when OTOOL_garbageCollector havetwo additional values to argument:
ALL
defaultgc
Where obviousy those needs OTOOL_JDK_VERSION set to 8,11...21 to properly determine default GC, or list of all GCs. The argument have priority over variable.
The top level run.sh can generate junit-like xml at the end, and is compressing all the logs to single archive (they can be huge)
run.sh <somegc> <someseconds>
run.sh "<gc1 gc2...>" (note the quotes) which then iterates through selectedGCs or set ALL to try all GCs
eg: run.sh "zgc shenandoah" 36000 which will run 10 hours zgc and then 10 hours of shenandoah. If you JVM do notsupport any of them, it will fail
It accepts: HEAPSIZE=3g ITEMS=250 THREADS=2 DURATION=18000 # 5 hours (in seconds)# COMPUTATIONS=64 BLOCKS=16 OTOOL_garbageCollector and JAVA_HOME env variables
The variables have priority over arguments
The top level run.sh can generate junit-like xml and tapfile at the end, and is compressing all the logs to single archive (they can be huge)
Note, that if more then one gc is part of the argument/OTOOL_garbageCollector final enumeration, the DURATION applied to each of them. if you use ALL, the DURATION is split among final set (as you never know how much you will actually run)
The top level run.sh is the only runner whcih can run from custom directory.
The top level run.sh is the only runner which can run from custom directory.

Arguments
---------
Expand Down
67 changes: 47 additions & 20 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ function globalInfo() {
uname -a > outlog-global
${LJAVA} -version 2>>outlog-global || true
echo "NOCOMP=${NOCOMP}">>outlog-global
echo "DURATION=${DURATION}">>outlog-global
echo "GC=${GC}">>outlog-global
echo "GC_ARG=${GC_ARG}">>outlog-global
echo "OTOOL_garbageCollector=${OTOOL_garbageCollector}">>outlog-global
echo "OTOOL_JDK_VERSION=${OTOOL_JDK_VERSION}">>outlog-global
}

function junitResults() {
Expand Down Expand Up @@ -120,12 +121,26 @@ function tapResults() {

getjava

GC=${1}
if [ "x$GC" == "x" ] ; then
#todo add generational zgc since jdk21, todo add generational shenandoah sicnce jdk23?
if [ "x$OTOOL_garbageCollector" == "xshentraver" ] ; then
GC_ARG=${1}
if [ "x$OTOOL_garbageCollector" = "x" ] ; then
GC_ARG=${GC_ARG}
else
GC_ARG=${OTOOL_garbageCollector}
fi
DURATION_ARG=${2}
if [ "x$DURATION" = "x" ] ; then
DURATION=${DURATION_ARG}
else
DURATION=${DURATION}
fi
if [ "x$DURATION" == "x" ] ; then
DURATION=18000 # 5 hours (in seconds)
fi

#determine ALL/defaultgc and some aliases GC_ARG
if [ "x$GC_ARG" == "xshentraver" ] ; then
GC=shenandoah
elif [ "x$OTOOL_garbageCollector" == "xALL" ] ; then
elif [ "x$GC_ARG" == "xALL" ] ; then
GC=""
if checkXX UseShenandoahGC ; then
GC="$GC shenandoah"
Expand All @@ -148,25 +163,40 @@ if [ "x$GC" == "x" ] ; then
if checkXX UseG1GC ; then
GC="$GC g1"
fi
elif [ "x$OTOOL_garbageCollector" == "xdefaultgc" ] ; then
if [ "0$OTOOL_JDK_VERSION" -le 8 ] ; then
elif [ "x$GC_ARG" == "xdefaultgc" ] ; then
if checkXX UseParallelGC | grep true ; then
GC=par
echo "double checking default gc is correct:"
checkXX UseParallelGC | grep true
else
elif checkXX UseG1GC | grep true ; then
GC=g1
echo "double checking default gc is correct:"
checkXX UseG1GC | grep true
else
echo "Unknown default gc!"
exit 2
fi
else
GC="$OTOOL_garbageCollector"
GC="$GC_ARG"
fi
fi


echo "GC=$GC" >&2

if [ "x$GC" == "x" ] ; then
echo 'expected exactly one command line argument - garbage collector [g1|cms|par|shenandoah] or use OTOOL_garbageCollector variabnle with same values + two more - "defaultgc" and "ALL", wich will cause this to use default gc or iterate through all GCs (time will be divided). You should accompany it by OTOOL_JDK_VERSION=<8..21> so the proper set of jdks is chosen. Use NOCOMP=-nocoops to disable compressed oops.' >&2
set +x
echo 'expected 1 mandatory and up to one optional positional command-line argument:
mandatory garbage collector [g1|cms|par|parold|zgc|zgcgen|shenandoah|ALL|defaultgc]
optional DURATION in seconds (but set up few hours for some real testing)
This script takes many environment values to tune the run, here is the list with defaults:
HEAPSIZE=3g
ITEMS=250
THREADS=2
COMPUTATIONS=64
BLOCKS=16
DURATION=18000 # 5 hours (in seconds)
OTOOL_garbageCollector # to set GC, no default
JAVA_HOME is used by default, if not there, is set from path
and a bit special :
NOCOMP
which is empty, by default, and can take exactly one vlauer NOCOMP=-nocoops to disable compressed oops.
The variables have priority over arguments. Namely OTOOL_garbageCollector and DURATION over 1st and 2nd arg' >&2
exit 1
fi

Expand All @@ -187,10 +217,7 @@ fi
if [ "x$THREADS" == "x" ] ; then
THREADS=2
fi
if [ "x$DURATION" == "x" ] ; then
DURATION=18000 # 5 hours (in seconds)
fi
if [ "x$OTOOL_garbageCollector" == "xALL" ] ; then
if [ "x$GC_ARG" == "xALL" ] ; then
gcs=`echo "$GC" | wc -w`
let "DURATION=$DURATION/$gcs"
echo "all GCs will run. Time per one is: $DURATION"
Expand Down

0 comments on commit 01f9894

Please sign in to comment.