test
This commit is contained in:
parent
5317a82ac4
commit
c0d58e6752
39
ppss.sh
39
ppss.sh
|
@ -63,6 +63,7 @@ PID="$$"
|
||||||
LISTENER_PID=""
|
LISTENER_PID=""
|
||||||
IFS_BACKUP="$IFS"
|
IFS_BACKUP="$IFS"
|
||||||
INTERVAL="30" # Polling interval to check if there are running jobs.
|
INTERVAL="30" # Polling interval to check if there are running jobs.
|
||||||
|
CPUINFO=/proc/cpuinfo
|
||||||
|
|
||||||
SSH_SERVER="" # Remote server or 'master'.
|
SSH_SERVER="" # Remote server or 'master'.
|
||||||
SSH_KEY="" # SSH key for ssh account.
|
SSH_KEY="" # SSH key for ssh account.
|
||||||
|
@ -379,9 +380,9 @@ do
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
--enable-ht|-j )
|
--disable-ht|-j )
|
||||||
HYPERTHREADING=yes
|
HYPERTHREADING=no
|
||||||
add_var_to_config HYPERTHREADING "yes"
|
add_var_to_config HYPERTHREADING $HYPERTHREADING
|
||||||
shift 1
|
shift 1
|
||||||
;;
|
;;
|
||||||
--log|-l )
|
--log|-l )
|
||||||
|
@ -695,7 +696,7 @@ get_no_of_cpus () {
|
||||||
|
|
||||||
if [ -z "$HPT" ]
|
if [ -z "$HPT" ]
|
||||||
then
|
then
|
||||||
HPT=no
|
HPT=yes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
got_cpu_info () {
|
got_cpu_info () {
|
||||||
|
@ -709,7 +710,7 @@ get_no_of_cpus () {
|
||||||
then
|
then
|
||||||
if [ "$ARCH" == "Linux" ]
|
if [ "$ARCH" == "Linux" ]
|
||||||
then
|
then
|
||||||
NUMBER=`cat /proc/cpuinfo | grep processor | wc -l`
|
NUMBER=`grep ^processor $CPUINFO | wc -l`
|
||||||
got_cpu_info "$?"
|
got_cpu_info "$?"
|
||||||
|
|
||||||
elif [ "$ARCH" == "Darwin" ]
|
elif [ "$ARCH" == "Darwin" ]
|
||||||
|
@ -721,22 +722,36 @@ get_no_of_cpus () {
|
||||||
NUMBER=`sysctl hw.ncpu | awk '{ print $2 }'`
|
NUMBER=`sysctl hw.ncpu | awk '{ print $2 }'`
|
||||||
got_cpu_info "$?"
|
got_cpu_info "$?"
|
||||||
else
|
else
|
||||||
NUMBER=`cat /proc/cpuinfo | grep processor | wc -l`
|
NUMBER=`grep ^processor $CPUINFO | wc -l`
|
||||||
got_cpu_info "$?"
|
got_cpu_info "$?"
|
||||||
fi
|
fi
|
||||||
elif [ "$HPT" == "no" ]
|
elif [ "$HPT" == "no" ]
|
||||||
then
|
then
|
||||||
|
log DEBUG "Hyperthreading is disabled."
|
||||||
if [ "$ARCH" == "Linux" ]
|
if [ "$ARCH" == "Linux" ]
|
||||||
then
|
then
|
||||||
RES=`cat /proc/cpuinfo | grep "cpu cores"`
|
PHYSICAL=`grep 'physical id' $CPUINFO`
|
||||||
if [ "$?" == "0" ]
|
if [ "$?" == "0" ]
|
||||||
then
|
then
|
||||||
NUMBER=`cat /proc/cpuinfo | grep "cpu cores" | cut -d ":" -f 2 | uniq | sed -e s/\ //g`
|
PHYSICAL=`grep 'physical id' $CPUINFO | sort | uniq | wc -l`
|
||||||
got_cpu_info "$?"
|
log DEBUG "Detected $PHYSICAL CPU(s)"
|
||||||
|
TMP=`grep 'cpu cores' $CPUINFO`
|
||||||
|
if [ "$?" == "0" ]
|
||||||
|
then
|
||||||
|
MULTICORE=`grep 'cpu cores' $CPUINFO | sort | uniq | cut -d ":" -f 2 | sed s/\ //g`
|
||||||
|
log DEBUG "Detected $MULTICORE cores per CPU."
|
||||||
|
NUMBER=$(($PHYSICAL*$MULTICORE))
|
||||||
else
|
else
|
||||||
NUMBER=`cat /proc/cpuinfo | grep processor | wc -l`
|
log DEBUG "Starting job only for each physical CPU."
|
||||||
|
NUMBER=$PHYSICAL
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
log DEBUG "No 'physical id' section found in $CPUINFO."
|
||||||
|
NUMBER=`grep ^processor $CPUINFO | wc -l`
|
||||||
got_cpu_info "$?"
|
got_cpu_info "$?"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
elif [ "$ARCH" == "Darwin" ]
|
elif [ "$ARCH" == "Darwin" ]
|
||||||
then
|
then
|
||||||
NUMBER=`sysctl -a hw | grep -w physicalcpu | awk '{ print $2 }'`
|
NUMBER=`sysctl -a hw | grep -w physicalcpu | awk '{ print $2 }'`
|
||||||
|
@ -746,7 +761,7 @@ get_no_of_cpus () {
|
||||||
NUMBER=`sysctl hw.ncpu | awk '{ print $2 }'`
|
NUMBER=`sysctl hw.ncpu | awk '{ print $2 }'`
|
||||||
got_cpu_info "$?"
|
got_cpu_info "$?"
|
||||||
else
|
else
|
||||||
NUMBER=`cat /proc/cpuinfo | grep "cpu cores" | cut -d ":" -f 2 | uniq | sed -e s/\ //g`
|
NUMBER=`cat $CPUINFO | grep "cpu cores" | cut -d ":" -f 2 | uniq | sed -e s/\ //g`
|
||||||
got_cpu_info "$?"
|
got_cpu_info "$?"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -849,7 +864,7 @@ upload_item () {
|
||||||
log DEBUG "Uploading item $ITEM."
|
log DEBUG "Uploading item $ITEM."
|
||||||
if [ "$SECURE_COPY" == "1" ]
|
if [ "$SECURE_COPY" == "1" ]
|
||||||
then
|
then
|
||||||
scp -q $SSH_OPTS $SSH_KEY $ITEM $USER@$SSH_SERVER:$REMOTE_OUTPUT_DIR
|
scp -q $SSH_OPTS $SSH_KEY "$ITEM" $USER@$SSH_SERVER:$REMOTE_OUTPUT_DIR
|
||||||
ERROR="$?"
|
ERROR="$?"
|
||||||
if [ ! "$ERROR" == "0" ]
|
if [ ! "$ERROR" == "0" ]
|
||||||
then
|
then
|
||||||
|
|
Loading…
Reference in New Issue