Whamcloud - gitweb
LU-3068 build: fix 'incorrect expression' errors
[fs/lustre-release.git] / lustre / scripts / bdev-io-survey.sh
index cea3066..084ca5a 100755 (executable)
@@ -12,6 +12,7 @@
 #      discard first vmstat line
 #
 
+HOSTNAME=`hostname`
 # a temp dir that is setup and torn down for each script run
 tmpdir=""
 # so we can kill background processes as the test cleans up
@@ -22,6 +23,9 @@ declare -a cleanup_mounts
 cur_y="0"
 # a global which funcs use to get at the blocks[] array
 last_block=-1
+# prefix to run oprofile or readprofile
+oprofile=""
+readprofile=""
 
 # defaults for some options:
 min_threads=1
@@ -418,14 +422,14 @@ echo_filter_config() {
        fi
 
        if [ $index = 0 ]; then
-               if ! lmc -m $config --add net  \
-                       --node localhost --nid localhost --nettype tcp; then
-                       echo "error adding localhost net node"
+               if ! lmc -m $config --add net \
+                       --node $HOSTNAME --nid $HOSTNAME --nettype tcp; then
+                       echo "error adding $HOSTNAME net node"
                        return 1
                fi
        fi
 
-       if ! lmc -m $config --add ost --ost ost_$index --node localhost \
+       if ! lmc -m $config --add ost --ost ost_$index --node $HOSTNAME \
                        --fstype ext3 --dev $bdev --journal_size 400; then
                echo "error adding $bdev to config with lmc"
                return 1
@@ -447,6 +451,10 @@ echo_filter_prepare() {
                        return 1;
                fi
                running_config="$config"
+
+               echo 0 > /proc/sys/lnet/debug
+               echo 0 > /proc/sys/lnet/subsystem_debug
+
                if ! grep -q '^obdecho\>' /proc/modules; then
                        local m
                        if ! modprobe obdecho; then
@@ -598,11 +606,13 @@ test_one() {
        done
 
        $oprofile opcontrol --reset
+       $readprofile -r
 
        # start all the tests.  each returns a pid to wait on
        pids=""
        for i in `seq 0 $last_block`; do
                local cmd=`${test}_start $threads $iosize $wor $i`
+               echo "$cmd" >> $tmpdir/commands
                $cmd > $tmpdir/$i 2>&1 &
                local pid=$!
                pids="$pids $pid"
@@ -628,11 +638,15 @@ test_one() {
                pid_has_stopped $pid
        done
 
+       $readprofile | sort -rn > $tmpdir/readprofile
+
        $oprofile opcontrol --shutdown
        $oprofile opreport > $tmpdir/oprofile
        echo >> $tmpdir/oprofile
        $oprofile opreport -c -l | head -20 >> $tmpdir/oprofile
+
        save_output $tmpdir/oprofile $opref.oprofile
+       save_output $tmpdir/readprofile $opref.readprofile
 
        # collect the results of vmstat and iostat
        cpu=$(mean_stddev $(awk \
@@ -792,6 +806,18 @@ else
         oprofile=": "
 fi
 
+if which readprofile; then
+       map="/boot/System.map-`uname -r`"
+       if [ -f /proc/profile -a -f "$map" ]; then
+               echo generating profiles with 'readprofile'
+               readprofile="readprofile -m $map"
+       fi
+fi
+if [ -z "$readprofile" ]; then
+       echo not using readprofile
+       readprofile=": "
+fi
+
 [ $min_threads -gt $max_threads ] && \
        die "min threads $min_threads must be <= min_threads $min_threads"
 
@@ -832,6 +858,8 @@ for t in $run_tests; do
        test_results="$test_results $t"
 done
 
+save_output $tmpdir/commands commands
+
 [ ! -z "$test_results" ] && (
        echo
        echo "T = number of concurrent threads per device"