#!/bin/sh
-export PATH=/sbin:/usr/sbin:$PATH
-
SRCDIR="`dirname $0`/"
-. $SRCDIR/common.sh
+export PATH=/sbin:/usr/sbin:$SRCDIR/../utils:$PATH
+
+LOOPS=${LOOPS:-1}
+COUNT=${COUNT:-100000}
+COUNT_10=`expr $COUNT / 10`
+COUNT_100=`expr $COUNT / 100`
+
+ENDRUN=endrun-`hostname`
+ECHONAME="`lctl device_list 2> /dev/null | awk '/ echo_client / { print $4 }' | tail -n 1`"
+
+if [ -z "$ECHONAME" ]; then
+ echo "$0: needs an ECHO_CLIENT set up first" 1>&2
+ exit 1
+fi
+
+cleanup () {
+ lctl --device \$$ECHONAME destroy $OID
+}
+
runthreads() {
THR=$1
DO=$2
DO=test_brw
RW=w
;;
-
test_brw_read)
DO=test_brw
RW=r
;;
esac
- if [ -e endrun ]; then
- rm endrun
- echo "exiting because endrun file was found"
- exit 0
- fi
+ lctl --threads $THR v \$$ECHONAME $DO $CNT $RW $V $PGS $OID || exit 1
- $OBDCTL --threads $THR v '$OSCDEV' $DO $CNT $RW $V $PGS $OID || exit 1
+ if [ -e $ENDRUN ]; then
+ rm $ENDRUN
+ echo "exiting because $ENDRUN file was found"
+ cleanup
+ fi
}
-if [ -z "`$OBDCTL device_list | grep osc`" ]; then
- setup_opts $@
-
- setup_portals
- setup_lustre
-
- setup_server || exit -1
- setup_client || exit -1
-fi
-
-OID=`$OBDCTL --device '$OSCDEV' create 1 | awk '/is object id/ { print $6 }'`
+[ -z "$OID" ] && OID=`lctl --device \\$$ECHONAME create 1 | awk '/is object id/ { print $6 }'` && echo "created object $OID"
[ -z "$OID" ] && echo "error creating object" 1>&2 && exit 1
# TODO: obdctl needs to check on the progress of each forked thread
# (IPC SHM, sockets?) to see if it hangs.
-while date; do
+for i in `seq $LOOPS`; do
PG=1
- PGV=16
+ PGVW=${PGVW:-16}
+ PGVR=${PGVR:-16}
+
# We use '--threads 1 X' instead of '--device X' so that
# obdctl can monitor the forked thread for progress (TODO).
debug_server_off
debug_client_off
- runthreads 1 test_brw_write 10000000 -30 $PG
- runthreads 1 test_brw_read 10000000 -30 $PG
+ runthreads 1 test_brw_write 1000 -30 $PG
+ runthreads 1 test_brw_read 1000 -30 $PG
- [ "$PGV" ] && runthreads 1 test_brw_write 1000000 -30 $PGV
- [ "$PGV" ] && runthreads 1 test_brw_read 1000000 -30 $PGV
+ [ "$PGVW" ] && runthreads 1 test_brw_write 100 -30 $PGVW
+ [ "$PGVW" ] && runthreads 1 test_brw_read 1600 -30 $PG
+ [ "$PGVR" ] && runthreads 1 test_brw_read 100 -30 $PGVR
- runthreads 2 test_brw_write 10000000 -30 $PG
- runthreads 2 test_brw_read 10000000 -30 $PG
+ runthreads 1 test_brw_write $COUNT -30 $PG
+ runthreads 1 test_brw_read $COUNT -30 $PG
- [ "$PGV" ] && runthreads 2 test_brw_write 1000000 -30 $PGV
- [ "$PGV" ] && runthreads 2 test_brw_read 1000000 -30 $PGV
+ [ "$PGVW" ] && runthreads 1 test_brw_write $COUNT_10 -30 $PGVW
+ [ "$PGVR" ] && runthreads 1 test_brw_read $COUNT_10 -30 $PGVR
- runthreads 10 test_brw_write 1000000 -30 $PG
- runthreads 10 test_brw_read 1000000 -30 $PG
+ runthreads 2 test_brw_write $COUNT -30 $PG
+ runthreads 2 test_brw_read $COUNT -30 $PG
- [ "$PGV" ] && runthreads 10 test_brw_write 100000 -60 $PGV
- [ "$PGV" ] && runthreads 10 test_brw_read 100000 -60 $PGV
+ [ "$PGVW" ] && runthreads 2 test_brw_write $COUNT_10 -30 $PGVW
+ [ "$PGVR" ] && runthreads 2 test_brw_read $COUNT_10 -30 $PGVR
- runthreads 32 test_brw_write 1000000 -30 $PG
- runthreads 32 test_brw_read 1000000 -30 $PG
+ runthreads 10 test_brw_write $COUNT_10 -30 $PG
+ runthreads 10 test_brw_read $COUNT_10 -30 $PG
- [ "$PGV" ] && runthreads 32 test_brw_write 100000 -60 $PGV
- [ "$PGV" ] && runthreads 32 test_brw_read 100000 -60 $PGV
+ [ "$PGVW" ] && runthreads 10 test_brw_write $COUNT_100 -60 $PGVW
+ [ "$PGVR" ] && runthreads 10 test_brw_read $COUNT_100 -60 $PGVR
- runthreads 64 test_brw_write 1000000 -30 $PG
- runthreads 64 test_brw_read 1000000 -30 $PG
+ runthreads 32 test_brw_write $COUNT_10 -30 $PG
+ runthreads 32 test_brw_read $COUNT_10 -30 $PG
- [ "$PGV" ] && runthreads 64 test_brw_write 100000 -60 $PGV
- [ "$PGV" ] && runthreads 64 test_brw_read 100000 -60 $PGV
+ [ "$PGVW" ] && runthreads 32 test_brw_write $COUNT_100 -60 $PGVW
+ [ "$PGVR" ] && runthreads 32 test_brw_read $COUNT_100 -60 $PGVR
- runthreads 100 test_brw_write 100000 -60 $PG
- runthreads 100 test_brw_read 100000 -60 $PG
+ runthreads 64 test_brw_write $COUNT_10 -30 $PG
+ runthreads 64 test_brw_read $COUNT_10 -30 $PG
- [ "$PGV" ] && runthreads 100 test_brw_write 100000 -60 $PGV
- [ "$PGV" ] && runthreads 100 test_brw_read 100000 -60 $PGV
-done
+ [ "$PGVW" ] && runthreads 64 test_brw_write $COUNT_100 -60 $PGVW
+ [ "$PGVR" ] && runthreads 64 test_brw_read $COUNT_100 -60 $PGVR
-$OBDCTL --device '$OSCDEV' destroy $OID
+ runthreads 100 test_brw_write $COUNT_100 -60 $PG
+ runthreads 100 test_brw_read $COUNT_100 -60 $PG
+
+ [ "$PGVW" ] && runthreads 100 test_brw_write $COUNT_100 -60 $PGVW
+ [ "$PGVR" ] && runthreads 100 test_brw_read $COUNT_100 -60 $PGVR
+done
-cleanup_client || exit -1
-cleanup_server || exit -1
-cleanup_lustre
-cleanup_portals
+cleanup