1#!/usr/bin/env bash 2 3curdir=$(readlink -f "$(dirname "$0")") 4rootdir=$(readlink -f "$curdir/../../../") 5 6source "$rootdir/test/vhost/common.sh" 7 8# Allow for the fio_conf() to slurp extra config from the stdin. 9exec {fio_extra_conf}<&0 10 11fio_conf() { 12 cat <<- FIO 13 [global] 14 ioengine=${ioengine:-libaio} 15 thread=1 16 group_reporting=1 17 direct=1 18 verify=0 19 norandommap=1 20 FIO 21 22 if [[ $ioengine == io_uring ]]; then 23 cat <<- FIO_URING 24 fixedbufs=${fixedbufs:-1} 25 hipri=${hipri:-1} 26 registerfiles=${registerfiles:-1} 27 sqthread_poll=${sqthread_poll:-1} 28 FIO_URING 29 fi 30 31 if [[ -e $fio_extra_conf ]]; then 32 # Overriden through cmdline|env 33 cat "$fio_extra_conf" 34 elif [[ ! -t $fio_extra_conf ]]; then 35 # Attached to stdin 36 cat <&"$fio_extra_conf" 37 fi 38 39 cat <<- FIO 40 [perf_test] 41 stonewall 42 description="Vhost performance test for a given workload" 43 bs=${blksize:-4k} 44 rw=${rw:-randread} 45 rwmixread=${rwmixread:-70} 46 iodepth=${iodepth:-128} 47 time_based=1 48 ramp_time=${ramptime:-10} 49 runtime=${runtime:-10} 50 numjobs=${numjobs:-1} 51 # This option is meant to be sed'ed by the vhost's run_fio() 52 filename= 53 FIO 54} 55 56(($#)) && eval "$@" 57 58perf_args+=("--vm-image=${vm_image:-$VM_IMAGE}") 59perf_args+=("--ctrl-type=${ctrl_type:-spdk_vhost_scsi}") 60perf_args+=(${split:+--use-split}) 61perf_args+=(${disk_map:+--disk-map="$disk_map"}) 62perf_args+=(${cpu_cfg:+--custom-cpu-cfg="$cpu_cfg"}) 63 64if [[ -n $extra_params ]]; then 65 perf_args+=($extra_params) 66fi 67 68trap 'rm -f "$curdir/fio.conf"' EXIT 69 70fio_conf > "$curdir/fio.conf" 71 72"$rootdir/test/vhost/perf_bench/vhost_perf.sh" \ 73 "${perf_args[@]}" --fio-jobs="$curdir/fio.conf"${fio_jobs:+",$fio_jobs"} 74