test/vhost_perf: enable host SAR CPU measurements
Add possibility to measure CPU utilization on host server while running FIO tests. Change-Id: Ibc76c2b1469974297350388880a036d8778e4713 Signed-off-by: Karol Latecki <karol.latecki@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/464563 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
2271c69500
commit
7f19b9c66d
@ -8,9 +8,10 @@ source $rootdir/test/vhost/common.sh
|
|||||||
vm_count=1
|
vm_count=1
|
||||||
vm_memory=2048
|
vm_memory=2048
|
||||||
vm_sar_enable=false
|
vm_sar_enable=false
|
||||||
vm_sar_delay="0"
|
host_sar_enable=false
|
||||||
vm_sar_interval="1"
|
sar_delay="0"
|
||||||
vm_sar_count="10"
|
sar_interval="1"
|
||||||
|
sar_count="10"
|
||||||
vm_throttle=""
|
vm_throttle=""
|
||||||
max_disks=""
|
max_disks=""
|
||||||
ctrl_type="spdk_vhost_scsi"
|
ctrl_type="spdk_vhost_scsi"
|
||||||
@ -46,10 +47,11 @@ function usage()
|
|||||||
echo " Default: 2048 MB"
|
echo " Default: 2048 MB"
|
||||||
echo " --vm-image=PATH OS image to use for running the VMs."
|
echo " --vm-image=PATH OS image to use for running the VMs."
|
||||||
echo " Default: \$HOME/vhost_vm_image.qcow2"
|
echo " Default: \$HOME/vhost_vm_image.qcow2"
|
||||||
echo " --vm-sar-enable Measure CPU utilization on VM using sar."
|
echo " --vm-sar-enable Measure CPU utilization in guest VMs using sar."
|
||||||
echo " --vm-sar-delay=INT Wait for X seconds before sarting SAR measurement on VMs. Default: 0."
|
echo " --host-sar-enable Measure CPU utilization on host using sar."
|
||||||
echo " --vm-sar-interval=INT Interval (seconds) argument for SAR. Default: 1s."
|
echo " --sar-delay=INT Wait for X seconds before starting SAR measurement. Default: 0."
|
||||||
echo " --vm-sar-count=INT Count argument for SAR. Default: 10."
|
echo " --sar-interval=INT Interval (seconds) argument for SAR. Default: 1s."
|
||||||
|
echo " --sar-count=INT Count argument for SAR. Default: 10."
|
||||||
echo " --vm-throttle-iops=INT I/Os throttle rate in IOPS for each device on the VMs."
|
echo " --vm-throttle-iops=INT I/Os throttle rate in IOPS for each device on the VMs."
|
||||||
echo " --max-disks=INT Maximum number of NVMe drives to use in test."
|
echo " --max-disks=INT Maximum number of NVMe drives to use in test."
|
||||||
echo " Default: will use all available NVMes."
|
echo " Default: will use all available NVMes."
|
||||||
@ -118,9 +120,10 @@ while getopts 'xh-:' optchar; do
|
|||||||
vm-memory=*) vm_memory="${OPTARG#*=}" ;;
|
vm-memory=*) vm_memory="${OPTARG#*=}" ;;
|
||||||
vm-image=*) VM_IMAGE="${OPTARG#*=}" ;;
|
vm-image=*) VM_IMAGE="${OPTARG#*=}" ;;
|
||||||
vm-sar-enable) vm_sar_enable=true ;;
|
vm-sar-enable) vm_sar_enable=true ;;
|
||||||
vm-sar-delay=*) vm_sar_delay="${OPTARG#*=}" ;;
|
host-sar-enable) host_sar_enable=true ;;
|
||||||
vm-sar-interval=*) vm_sar_interval="${OPTARG#*=}" ;;
|
sar-delay=*) sar_delay="${OPTARG#*=}" ;;
|
||||||
vm-sar-count=*) vm_sar_count="${OPTARG#*=}" ;;
|
sar-interval=*) sar_interval="${OPTARG#*=}" ;;
|
||||||
|
sar-count=*) sar_count="${OPTARG#*=}" ;;
|
||||||
vm-throttle-iops=*) vm_throttle="${OPTARG#*=}" ;;
|
vm-throttle-iops=*) vm_throttle="${OPTARG#*=}" ;;
|
||||||
max-disks=*) max_disks="${OPTARG#*=}" ;;
|
max-disks=*) max_disks="${OPTARG#*=}" ;;
|
||||||
ctrl-type=*) ctrl_type="${OPTARG#*=}" ;;
|
ctrl-type=*) ctrl_type="${OPTARG#*=}" ;;
|
||||||
@ -351,22 +354,35 @@ for i in $(seq 1 $fio_iterations); do
|
|||||||
run_fio $fio_bin --job-file="$fio_job" --out="$VHOST_DIR/fio_results" --json $fio_disks &
|
run_fio $fio_bin --job-file="$fio_job" --out="$VHOST_DIR/fio_results" --json $fio_disks &
|
||||||
fio_pid=$!
|
fio_pid=$!
|
||||||
|
|
||||||
if $vm_sar_enable; then
|
if $host_sar_enable || $vm_sar_enable; then
|
||||||
sleep $vm_sar_delay
|
|
||||||
mkdir -p $VHOST_DIR/fio_results/sar_stats
|
|
||||||
pids=""
|
pids=""
|
||||||
|
mkdir -p $VHOST_DIR/fio_results/sar_stats
|
||||||
|
sleep $sar_delay
|
||||||
|
fi
|
||||||
|
|
||||||
|
if $host_sar_enable; then
|
||||||
|
sar -P ALL $sar_interval $sar_count > "$VHOST_DIR/fio_results/sar_stats/sar_stats_host.txt" &
|
||||||
|
pids+=" $!"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if $vm_sar_enable; then
|
||||||
for vm_num in $used_vms; do
|
for vm_num in $used_vms; do
|
||||||
vm_exec "$vm_num" "mkdir -p /root/sar; sar -P ALL $vm_sar_interval $vm_sar_count >> /root/sar/sar_stats_VM${vm_num}_run${i}.txt" &
|
vm_exec "$vm_num" "mkdir -p /root/sar; sar -P ALL $sar_interval $sar_count >> /root/sar/sar_stats_VM${vm_num}_run${i}.txt" &
|
||||||
pids+=" $!"
|
pids+=" $!"
|
||||||
done
|
done
|
||||||
for j in $pids; do
|
fi
|
||||||
|
|
||||||
|
for j in $pids; do
|
||||||
wait $j
|
wait $j
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if $vm_sar_enable; then
|
||||||
for vm_num in $used_vms; do
|
for vm_num in $used_vms; do
|
||||||
vm_scp "$vm_num" "root@127.0.0.1:/root/sar/sar_stats_VM${vm_num}_run${i}.txt" "$VHOST_DIR/fio_results/sar_stats"
|
vm_scp "$vm_num" "root@127.0.0.1:/root/sar/sar_stats_VM${vm_num}_run${i}.txt" "$VHOST_DIR/fio_results/sar_stats"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
wait $fio_pid
|
wait $fio_pid
|
||||||
mv $VHOST_DIR/fio_results/$fio_log_fname $VHOST_DIR/fio_results/$fio_log_fname.$i
|
mv $VHOST_DIR/fio_results/$fio_log_fname $VHOST_DIR/fio_results/$fio_log_fname.$i
|
||||||
sleep 1
|
sleep 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user