From 9a6cb10b92c11dd5811c8bc3a1ef7fbbedd34feb Mon Sep 17 00:00:00 2001 From: Jiri Vanek Date: Thu, 29 Feb 2024 13:56:57 +0100 Subject: [PATCH 1/3] Distinguish between parallel gc and old parallel gc --- bin/par.sh | 2 +- bin/parold.sh | 30 ++++++++++++++++++++++++++++++ bin/runparold-nocoops.sh | 29 +++++++++++++++++++++++++++++ bin/runparold.sh | 28 ++++++++++++++++++++++++++++ 4 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 bin/parold.sh create mode 100755 bin/runparold-nocoops.sh create mode 100755 bin/runparold.sh diff --git a/bin/par.sh b/bin/par.sh index 1ae8ca9..cddccdf 100644 --- a/bin/par.sh +++ b/bin/par.sh @@ -25,6 +25,6 @@ # # set up GC_SPECIFIC_OPTS for parallel collector # and append par tag to gc log file name -export GC_SPECIFIC_OPTS="-XX:+UseParallelGC -XX:+UseParallelOldGC" +export GC_SPECIFIC_OPTS="-XX:+UseParallelGC" export GC_LOG_FILE="${GC_LOG_FILE}-par" export OUT_LOG_FILE="${OUT_LOG_FILE}-par" diff --git a/bin/parold.sh b/bin/parold.sh new file mode 100644 index 0000000..c8b1890 --- /dev/null +++ b/bin/parold.sh @@ -0,0 +1,30 @@ +# +# JBoss, Home of Professional Open Source +# Copyright 2011, Red Hat and individual contributors +# by the @authors tag. See the copyright.txt in the distribution for a +# full listing of individual contributors. +# +# This is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation; either version 2.1 of +# the License, or (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this software; if not, write to the Free +# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +# 02110-1301 USA, or see the FSF site: http://www.fsf.org. +# +# @authors Andrew Dinn +# +# setup script to use parallel collector +# +# set up GC_SPECIFIC_OPTS for parallel collector +# and append par tag to gc log file name +export GC_SPECIFIC_OPTS="-XX:+UseParallelGC -XX:+UseParallelOldGC" +export GC_LOG_FILE="${GC_LOG_FILE}-parold" +export OUT_LOG_FILE="${OUT_LOG_FILE}-parold" diff --git a/bin/runparold-nocoops.sh b/bin/runparold-nocoops.sh new file mode 100755 index 0000000..28cc1ad --- /dev/null +++ b/bin/runparold-nocoops.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# +# JBoss, Home of Professional Open Source +# Copyright 2011, Red Hat and individual contributors +# by the @authors tag. See the copyright.txt in the distribution for a +# full listing of individual contributors. +# +# This is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation; either version 2.1 of +# the License, or (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this software; if not, write to the Free +# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +# 02110-1301 USA, or see the FSF site: http://www.fsf.org. +# +# @authors Andrew Dinn +# +WD=`dirname $0` +. $WD/setup.sh +. $WD/parold.sh +. $WD/nocoops.sh +exec $WD/run.sh $* diff --git a/bin/runparold.sh b/bin/runparold.sh new file mode 100755 index 0000000..eab256e --- /dev/null +++ b/bin/runparold.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# +# JBoss, Home of Professional Open Source +# Copyright 2011, Red Hat and individual contributors +# by the @authors tag. See the copyright.txt in the distribution for a +# full listing of individual contributors. +# +# This is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation; either version 2.1 of +# the License, or (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this software; if not, write to the Free +# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +# 02110-1301 USA, or see the FSF site: http://www.fsf.org. +# +# @authors Andrew Dinn +# +WD=`dirname $0` +. $WD/setup.sh +. $WD/parold.sh +exec $WD/run.sh $* From 17f1b833249028f9efee13a4411f4b39ed592b0a Mon Sep 17 00:00:00 2001 From: Jiri Vanek Date: Thu, 29 Feb 2024 14:00:59 +0100 Subject: [PATCH 2/3] main run.sh now disnguish all gcs dynamically, not by hardcoded list --- run.sh | 43 ++++++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/run.sh b/run.sh index 8d0b842..6047841 100644 --- a/run.sh +++ b/run.sh @@ -9,7 +9,7 @@ done readonly CH_SCRIPT_DIR="$( cd -P "$( dirname "$SCRIPT_SOURCE" )" && pwd )" set -ex -function ljava() { +function getjava() { if [ "x$JAVA_HOME" != "x" ]; then LJAVA=${JAVA_HOME}/bin/java LJAR=${JAVA_HOME}/bin/jar @@ -30,9 +30,12 @@ function ljava() { fi } +function checkXX() { + ${LJAVA} -XX:+PrintFlagsFinal -version 2>/dev/null | grep -e ${1} +} + function globalInfo() { uname -a > outlog-global - ljava ${LJAVA} -version 2>>outlog-global || true echo "NOCOMP=${NOCOMP}">>outlog-global echo "GC=${GC}">>outlog-global @@ -99,6 +102,7 @@ function tapResults() { ) || true } +getjava GC=${1} if [ "x$GC" == "x" ] ; then @@ -106,17 +110,27 @@ if [ "x$GC" == "x" ] ; then if [ "x$OTOOL_garbageCollector" == "xshentraver" ] ; then GC=shenandoah elif [ "x$OTOOL_garbageCollector" == "xALL" ] ; then - if [ "x$OTOOL_JDK_VERSION" == "x" ] ; then - GC="shenandoah zgc cms par g1" ## unset, main set set - elif [ "0$OTOOL_JDK_VERSION" -le 7 ] ; then - GC=" cms par g1" ## we claim adoptium jdk8 as 7, as it do not have shenandoah. - elif [ "0$OTOOL_JDK_VERSION" -ge 8 -a "0$OTOOL_JDK_VERSION" -le 11 ] ; then - GC="shenandoah cms par g1" # zgc arrived in jdk11 - elif [ "0$OTOOL_JDK_VERSION" -gt 11 -a "0$OTOOL_JDK_VERSION" -le 20 ] ; then - GC="shenandoah zgc g1" # no more cms or par - else - # in jdk 21 arrived generational zgc - GC="shenandoah zgc g1 zgcgen" # zgcgem arrived in jdk21 + GC="" + if checkXX UseShenandoahGC ; then + GC="$GC shenandoah" + fi + if checkXX UseZGC ; then + GC="$GC zgc" + if checkXX ZGenerational ; then + GC="$GC zgcgen" + fi + fi + if checkXX UseConcMarkSweepGC ; then + GC="$GC cms" + fi + if checkXX UseParallelGC ; then + GC="$GC par" + if checkXX UseParallelOldGC ; then + GC="$GC parold" + fi + fi + if checkXX UseG1GC ; then + GC="$GC g1" fi elif [ "x$OTOOL_garbageCollector" == "xdefaultgc" ] ; then if [ "0$OTOOL_JDK_VERSION" -le 8 ] ; then @@ -130,13 +144,13 @@ if [ "x$GC" == "x" ] ; then 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 exit 1 fi if [ ! "x$STAMP" == "x" ] ; then - ljava arch=`uname -m | sed "s/[^a-zA-Z0-9_]//g"` os=`uname -o | sed "s/[^a-zA-Z0-9_]//g"` jdk=`${LJAVA} -version 2>&1 | head -n1 | sed -E "s/[^0-9]+/-/g"` @@ -177,7 +191,6 @@ if [ ! -e ${CH_SCRIPT_DIR}/target ] ; then mvn $MVOPTS install popd else - ljava pushd $CH_SCRIPT_DIR/src/main/java/ ${LJAVAC} -d $CH_SCRIPT_DIR/target/classes `find . -type f | grep ".java$"` pushd $CH_SCRIPT_DIR/target/classes From ced0baff6729b927b7e231038e5447df6c00a53c Mon Sep 17 00:00:00 2001 From: Jiri Vanek Date: Thu, 29 Feb 2024 14:05:06 +0100 Subject: [PATCH 3/3] Double checking defautl gc is correct --- run.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/run.sh b/run.sh index 6047841..79db605 100644 --- a/run.sh +++ b/run.sh @@ -135,8 +135,12 @@ if [ "x$GC" == "x" ] ; then elif [ "x$OTOOL_garbageCollector" == "xdefaultgc" ] ; then if [ "0$OTOOL_JDK_VERSION" -le 8 ] ; then GC=par + echo "double checking default gc is correct:" + checkXX UseParallelGC | grep true else GC=g1 + echo "double checking default gc is correct:" + checkXX UseG1GC | grep true fi else GC="$OTOOL_garbageCollector"