Skip to content

Commit

Permalink
Merge pull request #27 from redhat-performance/harden
Browse files Browse the repository at this point in the history
Harden specjbb
  • Loading branch information
dvalinrh authored Jun 29, 2023
2 parents 4504fd5 + 3fb5256 commit 195b503
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 25 deletions.
4 changes: 4 additions & 0 deletions specjbb/specjbb_extra/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ date
hostname
lscpu
numactl --hardware
if [ $? -ne 0 ]; then
echo Warning, unable to obtain numa hardware info.
fi
cat /proc/meminfo
cat /etc/*release
uname -a
Expand Down Expand Up @@ -55,3 +58,4 @@ fi
$java \
-Xms8192m -Xmx8192m $xss_value -XX:+UseParallelOldGC $aggressive -XX:+UseBiasedLocking -XX:+UseCompressedOops -XX:SurvivorRatio=24 spec.jbb.JBBmain -propfile $PROPS_FILE
date
exit $?
70 changes: 45 additions & 25 deletions specjbb/specjbb_run
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#
# Defined options
#
rtc=0
arguments="$@"
test_name="specjbb"
declare -a nodes
Expand All @@ -46,12 +47,15 @@ test_status="Ran"
tools_git=https://github.com/redhat-performance/test_tools-wrappers

if [ ! -f "/tmp/${test_name}.out" ]; then
command="${0} $@"
echo $command
$command &> /tmp/${test_name}.out
cat /tmp/${test_name}.out
rm /tmp/${test_name}.out
exit
command="${0} $@"
echo $command
$command &> /tmp/${test_name}.out
rtc=$?
if [[ -f /tmp/${test_name}.out ]]; then
cat /tmp/${test_name}.out
rm /tmp/${test_name}.out
fi
exit $?
fi

#
Expand All @@ -77,6 +81,12 @@ else
fi
fi

error_out()
{
echo $1
exit $2
}

#
# How many cpus in the system
#
Expand Down Expand Up @@ -281,6 +291,9 @@ execute_specjbb()
if [[ $node_pinning == "y" ]]; then
echo numactl --membind $jvms --cpunodebind $jvms ./run.sh $java_exec
numactl --membind $jvms --cpunodebind $jvms ./run.sh $java_exec >> /tmp/${test_name}_${to_tuned_setting}_job_${jvms}.out &
if [ $? -ne 0 ]; then
error_out "Warning: numactl failed" 1
fi
else
./run.sh $java_exec >> /tmp/${test_name}_${to_tuned_setting}_job_${jvms}.out &
fi
Expand All @@ -295,7 +308,13 @@ execute_specjbb()
#
for pid in ${pids[*]}; do
wait $pid
if [ $? -ne 0 ]; then
rtc=1
fi
done
if [ $rtc -ne 0 ]; then
echo "One or more specjbb jobs failed"
fi
concat_files $nr_jvms
}

Expand Down Expand Up @@ -323,10 +342,10 @@ run_specjbb()
for iterations in 1 `seq 2 1 $to_times_to_run`; do
pindex=0
if test -f "$file"; then
while IFS= read -r specjbb_opts
while IFS= read -r specjbb_opts
do
execute_specjbb $specjbb_opts
done < "$file"
done < "$file"
else
execute_specjbb $specjbb_opts
fi
Expand All @@ -335,9 +354,9 @@ run_specjbb()
timestamp=`date | sed "s/ /_/g"`
pushd /tmp > /dev/null
RESULTSDIR=results_${test_name}_${tuned_setting}_$(date "+%Y.%m.%d-%H.%M.%S")
mkdir ${RESULTSDIR}
mkdir ${RESULTSDIR}
rm results_${test_name}_${to_tuned_setting}
cp -R -s ${RESULTSDIR} results_${test_name}_${to_tuned_setting}
cp -R -s ${RESULTSDIR} results_${test_name}_${to_tuned_setting}
cp ${curdir}/meta_data.yml results_${test_name}_${to_tuned_setting}
mv ${test_name}.out results_${test_name}_${to_tuned_setting}
echo $test_status > results_${test_name}_${to_tuned_setting}/test_results_report
Expand Down Expand Up @@ -370,9 +389,9 @@ run_pbench_pbench_specjbb()
for specdir in `ls -d /var/lib/pbench-agent/specjbb2005*`; do
pushd /tmp > /dev/null
RESULTSDIR=results_${test_name}_${tuned_setting}_$(date "+%Y.%m.%d-%H.%M.%S")
mkdir ${RESULTSDIR}
mkdir ${RESULTSDIR}
rm results_${test_name}_${to_tuned_setting}
cp -R ${RESULTSDIR} results_${test_name}_${to_tuned_setting}
cp -R ${RESULTSDIR} results_${test_name}_${to_tuned_setting}
timestamp=`date | sed "s/ /_/g"`

cp -R $specdir/results results_${test_name}_${to_tuned_setting}
Expand All @@ -390,13 +409,13 @@ run_pbench_pbench_specjbb()
popd > /dev/null
done
value=`$TOOLS_BIN/set_pbench_variables --host_config $to_configuration --sys_type $to_sys_type --test ${test_name} --pbench_user $to_puser --run_label $to_run_label`
hostname=`echo $value | cut -d: -f 1| sed "s/${to_puser}_//g"`
hostname=`echo $value | cut -d: -f 1| sed "s/${to_puser}_//g"`

export hostname
results_prefix=`echo $value | cut -d: -f 2`
export hostname
results_prefix=`echo $value | cut -d: -f 2`

echo $TOOLS_BIN/pbench_copy_data --hostname "${to_puser}_${to_run_label}" --user "${to_puser}" --prefix ${results_prefix}
$TOOLS_BIN/pbench_copy_data --hostname "${to_puser}_${to_run_label}" --user "${to_puser}" --prefix ${results_prefix}
echo $TOOLS_BIN/pbench_copy_data --hostname "${to_puser}_${to_run_label}" --user "${to_puser}" --prefix ${results_prefix}
$TOOLS_BIN/pbench_copy_data --hostname "${to_puser}_${to_run_label}" --user "${to_puser}" --prefix ${results_prefix}
}

#
Expand All @@ -406,6 +425,7 @@ run_specjbb_via_pbench()
{
cd ${curdir}
$TOOLS_BIN/execute_via_pbench --cmd_executing "$0" $arguments --test $test_name --spacing 11 --pbench_stats $to_pstats
rtc=$?
}

usage()
Expand Down Expand Up @@ -452,11 +472,10 @@ done
# clone the repo.
#
if [ ! -d "test_tools" ]; then
git clone $tools_git test_tools
if [ $? -ne 0 ]; then
echo pulling git $tools_git failed.
exit
fi
git clone $tools_git test_tools
if [ $? -ne 0 ]; then
error_out "pulling git $tools_git failed." 1
fi
fi

if [ $show_usage -eq 1 ]; then
Expand Down Expand Up @@ -511,7 +530,7 @@ opts=$(getopt \
# Verify there were no errors
#
if [ $? -ne 0 ]; then
exit
error_out "Failed: parsing arguments." 1
fi

eval set --$opts
Expand All @@ -523,7 +542,7 @@ eval set --$opts
numb_nodes=$(ls -1d /sys/devices/system/node/node* | wc -l)

while [[ $# -gt 0 ]]; do
case "$1" in
case "$1" in
--inc-warehouses)
increment_warehouse=$2
shift 2
Expand Down Expand Up @@ -617,7 +636,7 @@ for entry in $nodes; do
# Node determination
#
if [ "${entry}" == "node" ]; then
nr_jvms=$numb_nodes
nr_jvms=$numb_nodes
else
nr_jvms=$entry
fi
Expand All @@ -643,3 +662,4 @@ for entry in $nodes; do
run_specjbb
fi
done
exit $rtc

0 comments on commit 195b503

Please sign in to comment.