1、测试脚本
#!/bin/bash
RESULT_DIR=/sf/log/vs/vst_perf
function do_fio_test()
{
local filename=$1
local rw_type=$2
local bs_type=$3
local depth_type=$4
local rw_model=""
local cmd=""
local result_file=""
local summary_result="$RESULT_DIR/vst_diskPerf_fio.log"
file_end=$(echo $filename |awk -F '/' '{print $3}')
if [[ "$rw_type" =~ "randrw" ]];then
rw_model="$rw_type -rwmixread=70"
else
rw_model="$rw_type"
fi
for depth in $depth_type; do
result_file="$RESULT_DIR/fio_${bs_type}_${rw_type/=/-}_$file_end.log"
cmd="fio -name=fiotest -filename=$filename -group_reporting -direct=1 -iodepth=$depth -ioengine=libaio -rw=$rw_model -bs=$bs_type -numjobs=1 -runtime=300"
echo "$cmd > $result_file"
$cmd > $result_file
echo $result_file >> $summary_result
if [[ "$result_file" =~ "rw" ]];then
grep -E "read :|write:" $result_file >> $summary_result
else
if [[ "$result_file" =~ "read" ]];then
grep "read :" $result_file >> $summary_result
else
grep "write:" $result_file >> $summary_result
fi
fi
done
}
function analize_result()
{
for file in $(find $RESULT_DIR -maxdepth 1 -type f -name "fio*.log"