I guess we could just change the "mprime" script to do that:
! NOT TESTED YET !
Code:
#!/bin/sh
#
# Wrapper for the Mersenne Prime Torture test (mprime)
# ====================================================
#
# 'mprime' is a wrapper that automaticly detects the number of CPUs so they can be
# stressed all at the same time. It will run an instance of 'mprime' for each
# CPU in order to heat all CPUs up at the same time. You can do this by running
# the background option (-bn with n= number of processes). However, this option
# does not display any output on the screen. This can be solved by running several
# instances of mprime with the background (&) option of the shell. This method
# displays the output of the multiple instances of mprime.
#
# This wrapper allows the user to choose which version of mprime he wants to use.
# mprime ==> will prompt to ask which version should be used
# mprime 23 ==> will run 'Mersenne Prime 23.5.2'
# mprime 24 ==> will run 'Mersenne Prime 24.14.2'
#
# This wrapper avoids specifying the working directory part (-W) and the torure
# (-t) option of the command 'mprime -t -W/tmp/torture-test/torture.XXXXXX',
# so the user can run 'mprime' from a terminal without worrying which parameters
# to add to use the torture test of Mersenne Prime Test.
#
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
# Last updated by Gert Hulselmans on 26 February 2009.
# Changes by gloutch 2001-03-10 identified by CHANGE HERE comments
#CHANGE HERE
echo -e "\033[9;0]" >/dev/console
echo -e "\033[14;0]" >/dev/console
#END CHANGE HERE
CPUS=`awk '/^processor/ {CPU=$3}; END {print CPU+1}' /proc/cpuinfo`
mkdir -p /tmp/torture-test/
echo -e '\033[0;32mMersenne Prime Torture test:'
echo -e '============================\033[0m'
echo
case "$1" in
23)
echo "The torture test will be executed with 'Mersenne Prime 23.5.2' (mprime23)."
MPRIME=/opt/mprime/mprime23
;;
24)
echo "The torture test will be executed with 'Mersenne Prime 24.14.2' (mprime24)."
MPRIME=/opt/mprime/mprime24
;;
*)
echo "Which version of 'Mersenne Prime' do you want to use?"
echo " 1) version 24.14.2 (default) Press any key exept '2'"
echo " 2) version 23.5.2 Press '2'"
echo -n 'Choose: '
read -n1 -t 15 CHOISE
echo
if [ "$CHOISE" == "2" ]; then
echo "The torture test will be executed with 'Mersenne Prime 23.5.2' (mprime23)."
MPRIME=/opt/mprime/mprime23
else
echo "The torture test will be executed with 'Mersenne Prime 24.14.2' (mprime24)."
MPRIME=/opt/mprime/mprime24
fi
;;
esac
echo
echo 'Automatic detection of the number of CPUs:'
echo
if [ "$CPUS" == "1" ]; then
WORKING_DIR=`mktemp -d -p /tmp/torture-test torture.XXXXXX`
echo '1 CPU detected.'
echo "Running 1 instance of mprime ('$MPRIME -t -W$WORKING_DIR')."
echo
#CHANGE HERE (& added)
$MPRIME -t -W$WORKING_DIR &
#END CHANGE HERE
else
echo "$CPUS CPUs detected."
echo "To stress all CPUs, $CPUS instances of $MPRIME will be run in the background."
echo
echo -e '\033[01;31mTo stop the torture test, press any key.\033[0m'
for i in `seq 1 $CPUS`; do
WORKING_DIR=`mktemp -d -p /tmp/torture-test torture.XXXXXX`
echo
echo "Starting instance $i of mprime ('$MPRIME -t -W$WORKING_DIR &')."
echo
$MPRIME -t -W$WORKING_DIR &
done
#CHANGE HERE
# read -s -n1
# pkill mprime
#END CHANGE HERE
fi
#CHANGE HERE
KEYPRESS="none"
DELAY=15
while true; do
cat /proc/uptime
read -s -n1 -t $DELAY KEYPRESS
if [ "$KEYPRESS"X != "noneX" ]; then
break
fi
DELAY = $((DELAY*2))
if [ $DELAY -gt 3600 ]; then
DELAY=3600
fi
done
pkill mprime
#END CHANGE HERE
If you want, you can send the uptime log to another console, just do
cat /proc/uptime > /dev/tty3
for the 3rd console for example.