Hi,
I have worked out the following patch, which empowers "ltp/runltp" to
fully exploit all the features provided by "ltp/tools/genload/stress".
See whether it works properly for you.
--Subrata--
On Sun, 2007-09-16 at 21:57 +0530, Subrata Modak wrote:
> >
> > To run that tags more than once, you need to use the -i M option, then
> > pan will run each tag M times. Although the algorithm will complete all
> > tags once before starting the next iteration.
> >
> > Nate
>
> But i think, -i M through runltp will actually:
> 1) try to fork 1 genload process spinning indefinitely on sync(), and,
> 2) try to fork 1 genload process spinning indefinitely on write() to
> write M MB of random data to a temporary file.
> ThatÅ› what line no.s 189 and 190 of runltp specify.
>
> Now, regarding this (genload: ltp/tools/genload/stress.c), i have sent a
> mail earlier. If you see what <genload --help> displays:
>
> [EMAIL PROTECTED] ltp-full-20070831]$ ./tools/genload/stress
> --help
> `stress' imposes certain types of compute stress on your system
>
> Usage: stress [OPTION [ARG]] ...
>
> -?, --help show this help statement
> --version show version statement
> -v, --verbose be verbose
> -q, --quiet be quiet
> -n, --dry-run show what would have been done
> --no-retry exit rather than retry non-critical errors
> --retry-delay n wait n us before continuing past error
> -t, --timeout n timeout after n seconds
> --backoff n wait for factor of n us before starting work
> -c, --cpu n spawn n procs spinning on sqrt()
> -i, --io n spawn n procs spinning on sync()
> -m, --vm n spawn n procs spinning on malloc()
> --vm-chunks c malloc c chunks (default is 1)
> --vm-bytes b malloc chunks of b bytes (default is 256MB)
> --vm-hang hang in a sleep loop after memory allocated
> -d, --hdd n spawn n procs spinning on write()
> --hdd-noclean do not unlink file to which random data written
> --hdd-files f write to f files (default is 1)
> --hdd-bytes b write b bytes (default is 1GB)
>
> Infinity is denoted with 0. For -m, -d: n=0 means infinite redo,
> n<0 means redo abs(n) times. Valid suffixes are m,h,d,y for time;
> k,m,g for size.
>
> I think we do not exploit the entire set of such options through runltp.
> Now, we need to do that too.
>
> --Subrata--
--- ltp-full-20070930/runltp.orig 2007-10-04 15:35:02.000000000 +0530
+++ ltp-full-20070930/runltp 2007-10-04 20:47:57.000000000 +0530
@@ -96,19 +96,36 @@ usage()
cat <<-EOF >&2
usage: ./${0##*/} -c [-C FAILCMDFILE ] [-d TMPDIR] [-f CMDFILES(,...) ]
- [-i # (in Mb)] [ -l LOGFILE ] [ -o OUTPUTFILE ] [ -m # (in Mb)] -N -n -q
+ [ -l LOGFILE ] [ -o OUTPUTFILE ] -N -n -q
[ -r LTPROOT ] [ -s PATTERN ] [ -t DURATION ] -v [ -w CMDFILEADDR ]
[ -x INSTANCES ]
-C FAILCMDFILE Command file with all failed test cases.
- -c NUM_PROCS Run LTP under additional background CPU load.
+ -c NUM_PROCS Run LTP under additional background CPU load
+ [NUM_PROCS = no. of processes creating the CPU Load by spinning over sqrt()
+ (Defaults to 1 when value 0 or undefined)
-d TMPDIR Directory where temporary files will be created.
+ -D NUM_PROCS,NUM_FILES,NUM_BYTES,CLEAN_FLAG
+ Run LTP under additional background Load on Secondary Storage (Seperate by comma)
+ [NUM_PROCS = no. of processes creating Storage Load by spinning over write()
+ (Defaults to 1 when value 0 or undefined)]
+ [NUM_FILES = Write() to these many files (Defaults to 1 when value 0 or undefined)]
+ [NUM_BYTES = write these many bytes (defaults to 1GB, when value 0 or undefined) ]
+ [CLEAN_FLAG = unlink file to which random data written, when value 1]
-e Prints the date of the current LTP release
-f CMDFILES Execute user defined list of testcases (separate with ',')
-h Help. Prints all available options.
- -i # (in Mb) Run LTP with a _min_ IO load of # Mb in background.
+ -i NUM_PROCS Run LTP under additional background Load on IO Bus
+ [NUM_PROCS = no. of processes creating IO Bus Load by spinning over sync()
+ (Defaults to 1 when value 0 or undefined)]
-l LOGFILE Log results of test in a logfile.
- -m # (in Mb) Run LTP with a _min_ memory load of # Mb in background.
+ -m NUM_PROCS,CHUNKS,BYTES,HANGUP_FLAG
+ Run LTP under additional background Load on Main memory (Seperate by comma)
+ [NUM_PROCS = no. of processes creating main Memory Load by spinning over malloc()
+ (Defaults to 1 when value 0 or undefined)]
+ [CHUNKS = malloc these many chunks (default is 1 when value 0 or undefined)]
+ [BYTES = malloc CHUNKS of BYTES bytes (default is 256MB when value 0 or undefined) ]
+ [HANGUP_FLAG = hang in a sleep loop after memory allocated, when value 1]
-N Run all the networking tests.
-n Run LTP with network traffic in background.
-o OUTPUTFILE Redirect test output to a file.
@@ -125,7 +142,7 @@ usage()
-w CMDFILEADDR Uses wget to get the user's list of testcases.
-x INSTANCES Run multiple instances of this testsuite.
- example: ./${0##*/} -i 1024 -m 128 -p -q -l /tmp/resultlog.$$ -d ${PWD}
+ example: ./${0##*/} -c 2 -i 2 -m 2,4,10240,1 -D 2,10,10240,1 -p -q -l /tmp/result-log.$$ -o /tmp/result-output.$$ -C /tmp/result-failed.$$ -d ${PWD}
EOF
@@ -154,10 +171,13 @@ main()
local PAN_COMMAND=""
version_date=`head -n 1 $LTPROOT/ChangeLog`
- while getopts c:C:d:f:ehi:l:m:Nno:pqr:s:t:vw:x: arg
+ while getopts c:C:d:D:f:ehi:l:m:Nno:pqr:s:t:vw:x: arg
do case $arg in
c)
NUM_PROCS=$(($OPTARG))
+ if [ ! "$NUM_PROCS" -o "$NUM_PROCS" -eq 0 ]; then # User Did not Define the Value ,or, User Defined Zero,
+ NUM_PROCS=1 # hence, prevent from creating infinite processes
+ fi
$LTPROOT/testcases/bin/genload --cpu $NUM_PROCS >/dev/null 2>&1 &
GENLOAD=1 ;;
@@ -175,6 +195,45 @@ main()
export TMPBASE=$OPTARG
export TMP="${TMPBASE}/ltp-$$"
export TMPDIR="$TMP";;
+
+ D) NUM_PROCS=1; NUM_FILES=1; NUM_BYTES=$(1024 * 1024 * 1024); CLEAN_FLAG=0
+ ARGUMENT_LIST=$(($OPTARG))
+ if [ ! "$ARGUMENT_LIST" ]; then # User Did not Define
+ NUM_PROCS=1 # All values to Default
+ NUM_FILES=1
+ NUM_BYTES=$(1024 * 1024 * 1024)
+ CLEAN_FLAG=0
+ else # User has Defined Something
+ TOTAL_ARGUMENTS=1 # Initial Assume
+ for ARGUMENT in `echo "$ARGUMENT_LIST" | sed 's/,/\n/g'` # Store all value in a Loop
+ do
+ case $TOTAL_ARGUMENTS in
+ 1) NUM_PROCS="$ARGUMENT" ;;
+ 2) NUM_FILES="$ARGUMENT" ;;
+ 3) NUM_BYTES="$ARGUMENT" ;;
+ 4) CLEAN_FLAG="$ARGUMENT" ;;
+ esac
+ TOTAL_ARGUMENTS=`expr $TOTAL_ARGUMENTS + 1`
+ done
+ if [ ! "$NUM_PROCS" -o "$NUM_PROCS" -eq 0 ]; then # Verify once again if NUM_PROCS is defined and not Zero
+ NUM_PROCS=1
+ fi
+ if [ ! "$NUM_FILES" -o "$NUM_FILES" -eq 0 ]; then # Verify once again if NUM_FILES is defined and not Zero
+ NUM_FILES=1
+ fi
+ if [ ! "$NUM_BYTES" -o "$NUM_BYTES" -eq 0 ]; then # Verify once again if NUM_BYTES is defined and not Zero
+ NUM_BYTES=$(1024 * 1024 * 1024)
+ fi
+ if [ ! "$CLEAN_FLAG" -o "$CLEAN_FLAG" -ne 1 ]; then # Verify once again if CLEAN_FLAG is defined and 1
+ CLEAN_FLAG=0
+ fi
+ fi
+ if [ "$CLEAN_FLAG" -eq 1 ]; then # Do not unlink file in this case
+ $LTPROOT/testcases/bin/genload --hdd $NUM_PROCS --hdd-files $NUM_FILES --hdd-bytes $NUM_BYTES >/dev/null 2>&1 &
+ else # Cleanup otherwise
+ $LTPROOT/testcases/bin/genload --hdd $NUM_PROCS --hdd-files $NUM_FILES --hdd-bytes $NUM_BYTES --hdd-noclean >/dev/null 2>&1 &
+ fi
+ GENLOAD=1;;
e) # Print out the version of LTP
version_of_ltp
;;
@@ -185,11 +244,12 @@ main()
h) usage;;
- i)
- BYTESIZE=$(($OPTARG * 1024 * 1024))
- $LTPROOT/testcases/bin/genload --io 1 >/dev/null 2>&1 &
- $LTPROOT/testcases/bin/genload --hdd 1 --hdd-bytes $BYTESIZE \
- >/dev/null 2>&1 &
+ i)
+ NUM_PROCS=$(($OPTARG))
+ if [ ! "$NUM_PROCS" -o "$NUM_PROCS" -eq 0 ]; then # User Did not Define the Value ,or, User Defined Zero,
+ NUM_PROCS=1 # hence, prevent from creating infinite processes
+ fi
+ $LTPROOT/testcases/bin/genload --io $NUM_PROCS >/dev/null 2>&1 &
GENLOAD=1 ;;
l)
@@ -202,10 +262,43 @@ main()
ALT_DIR_RES=1 ;;
esac ;;
- m)
- MEMSIZE=$(($OPTARG * 1024 * 1024))
- $LTPROOT/testcases/bin/genload --vm 0 --vm-bytes $MEMSIZE \
- >/dev/null 2>&1 &
+ m) NUM_PROCS=1; CHUNKS=1; BYTES=$(256 * 1024 * 1024); HANGUP_FLAG=0
+ ARGUMENT_LIST=$(($OPTARG))
+ if [ ! "$ARGUMENT_LIST" ]; then # User Did not Define
+ NUM_PROCS=1 # All values to Default
+ CHUNKS=1
+ BYTES=$(256 * 1024 * 1024)
+ HANGUP_FLAG=0
+ else # User has Defined Something
+ TOTAL_ARGUMENTS=1 # Initial Assume
+ for ARGUMENT in `echo "$ARGUMENT_LIST" | sed 's/,/\n/g'` # Store all value in a Loop
+ do
+ case $TOTAL_ARGUMENTS in
+ 1) NUM_PROCS="$ARGUMENT" ;;
+ 2) CHUNKS="$ARGUMENT" ;;
+ 3) BYTES="$ARGUMENT" ;;
+ 4) HANGUP_FLAG="$ARGUMENT" ;;
+ esac
+ TOTAL_ARGUMENTS=`expr $TOTAL_ARGUMENTS + 1`
+ done
+ if [ ! "$NUM_PROCS" -o "$NUM_PROCS" -eq 0 ]; then # Verify once again if NUM_PROCS is defined and not Zero
+ NUM_PROCS=1
+ fi
+ if [ ! "$CHUNKS" -o "$CHUNKS" -eq 0 ]; then # Verify once again if CHUNKS is defined and not Zero
+ CHUNKS=1
+ fi
+ if [ ! "$BYTES" -o "$BYTES" -eq 0 ]; then # Verify once again if BYTES is defined and not Zero
+ BYTES=$(256 * 1024 * 1024)
+ fi
+ if [ ! "$HANGUP_FLAG" -o "$HANGUP_FLAG" -ne 1 ]; then # Verify once again if HANGUP_FLAG is defined and 1
+ HANGUP_FLAG=0
+ fi
+ fi
+ if [ "$HANGUP_FLAG" -eq 1 ]; then # Hang in a Sleep loop after memory allocated
+ $LTPROOT/testcases/bin/genload --vm $NUM_PROCS --vm-chunks $CHUNKS --vm-bytes $BYTES --vm-hang >/dev/null 2>&1 &
+ else # Otherwise Do not Hangup
+ $LTPROOT/testcases/bin/genload --vm $NUM_PROCS --vm-chunks $CHUNKS --vm-bytes $BYTES >/dev/null 2>&1 &
+ fi
GENLOAD=1;;
N) RUN_NETEST=1;;
@@ -483,8 +576,8 @@ main()
[ ! -z "$QUIET_MODE" ] && { echo "INFO: Test end time: $(date)" ; }
- [ "$GENLOAD" -eq 1 ] && { killall -9 genload ; }
- [ "$NETPIPE" -eq 1 ] && { killall -9 NPtcp ; }
+ [ "$GENLOAD" -eq 1 ] && { killall -9 genload >/dev/null 2>&1; }
+ [ "$NETPIPE" -eq 1 ] && { killall -9 NPtcp >/dev/null 2>&1; }
[ "$ALT_DIR_OUT" -eq 1 ] || [ "$ALT_DIR_RES" -eq 1 ] && \
{
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list