From 0655f92a0fea59f43eddef5d6c51e1d2cd5fc301 Mon Sep 17 00:00:00 2001 From: Karol Latecki Date: Thu, 9 Jul 2020 16:04:29 +0200 Subject: [PATCH] test/nvme_perf: improve fio results parsing - Change divisor in nsec to usec calculation to "1000". - Ignore MIX param when rw mode is set to 100% read or 100% write. - Use MIX param as number in 0.0-1.0 range for calculating summary read+write latency. - Use jq "//" alternative operator when querying for fields which might not exist in JSON object. Assume "0" for non-existent fields, otherwise jq reports "null", which in turn results in script errors. Change-Id: Ibc8f91f058d9ae31ee1b60f4b253c42b743ae22f Signed-off-by: Karol Latecki Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3294 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Paul Luse Reviewed-by: Tomasz Zawadzki Reviewed-by: Jim Harris --- test/nvme/perf/common.sh | 24 +++++++++++++----------- test/nvme/perf/run_perf.sh | 24 ++++++++++++++++-------- 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/test/nvme/perf/common.sh b/test/nvme/perf/common.sh index 9eea8bf65..fbf6ef5d6 100755 --- a/test/nvme/perf/common.sh +++ b/test/nvme/perf/common.sh @@ -263,44 +263,46 @@ function preconditioning() { } function get_results() { - local reads_pct=$2 - local writes_pct=$((100 - $2)) + local reads_pct + local writes_pct + reads_pct=$(bc -l <<< "scale=3; $2/100") + writes_pct=$(bc -l <<< "scale=3; 1-$reads_pct") case "$1" in iops) - iops=$(jq -r '.jobs[] | (.read.iops + .write.iops)' $NVME_FIO_RESULTS) + iops=$(jq -r '.jobs[] | .read.iops + .write.iops' $NVME_FIO_RESULTS) iops=${iops%.*} echo $iops ;; mean_lat_usec) mean_lat=$(jq -r ".jobs[] | (.read.lat_ns.mean * $reads_pct + .write.lat_ns.mean * $writes_pct)" $NVME_FIO_RESULTS) mean_lat=${mean_lat%.*} - echo $((mean_lat / 100000)) + echo $((mean_lat / 1000)) ;; p99_lat_usec) - p99_lat=$(jq -r ".jobs[] | (.read.clat_ns.percentile.\"99.000000\" * $reads_pct + .write.clat_ns.percentile.\"99.000000\" * $writes_pct)" $NVME_FIO_RESULTS) + p99_lat=$(jq -r ".jobs[] | (.read.clat_ns.percentile.\"99.000000\" // 0 * $reads_pct + .write.clat_ns.percentile.\"99.000000\" // 0 * $writes_pct)" $NVME_FIO_RESULTS) p99_lat=${p99_lat%.*} - echo $((p99_lat / 100000)) + echo $((p99_lat / 1000)) ;; p99_99_lat_usec) - p99_99_lat=$(jq -r ".jobs[] | (.read.clat_ns.percentile.\"99.990000\" * $reads_pct + .write.clat_ns.percentile.\"99.990000\" * $writes_pct)" $NVME_FIO_RESULTS) + p99_99_lat=$(jq -r ".jobs[] | (.read.clat_ns.percentile.\"99.990000\" // 0 * $reads_pct + .write.clat_ns.percentile.\"99.990000\" // 0 * $writes_pct)" $NVME_FIO_RESULTS) p99_99_lat=${p99_99_lat%.*} - echo $((p99_99_lat / 100000)) + echo $((p99_99_lat / 1000)) ;; stdev_usec) stdev=$(jq -r ".jobs[] | (.read.clat_ns.stddev * $reads_pct + .write.clat_ns.stddev * $writes_pct)" $NVME_FIO_RESULTS) stdev=${stdev%.*} - echo $((stdev / 100000)) + echo $((stdev / 1000)) ;; mean_slat_usec) mean_slat=$(jq -r ".jobs[] | (.read.slat_ns.mean * $reads_pct + .write.slat_ns.mean * $writes_pct)" $NVME_FIO_RESULTS) mean_slat=${mean_slat%.*} - echo $((mean_slat / 100000)) + echo $((mean_slat / 1000)) ;; mean_clat_usec) mean_clat=$(jq -r ".jobs[] | (.read.clat_ns.mean * $reads_pct + .write.clat_ns.mean * $writes_pct)" $NVME_FIO_RESULTS) mean_clat=${mean_clat%.*} - echo $((mean_clat / 100000)) + echo $((mean_clat / 1000)) ;; bw_Kibs) bw=$(jq -r ".jobs[] | (.read.bw + .write.bw)" $NVME_FIO_RESULTS) diff --git a/test/nvme/perf/run_perf.sh b/test/nvme/perf/run_perf.sh index 1322a6fd6..58c45e473 100755 --- a/test/nvme/perf/run_perf.sh +++ b/test/nvme/perf/run_perf.sh @@ -153,15 +153,23 @@ for ((j = 0; j < REPEAT_NO; j++)); do fi #Store values for every number of used disks - iops_disks[$k]=$((${iops_disks[$k]} + $(get_results iops $MIX))) - mean_lat_disks_usec[$k]=$((${mean_lat_disks_usec[$k]} + $(get_results mean_lat_usec $MIX))) - p99_lat_disks_usec[$k]=$((${p99_lat_disks_usec[$k]} + $(get_results p99_lat_usec $MIX))) - p99_99_lat_disks_usec[$k]=$((${p99_99_lat_disks_usec[$k]} + $(get_results p99_99_lat_usec $MIX))) - stdev_disks_usec[$k]=$((${stdev_disks_usec[$k]} + $(get_results stdev_usec $MIX))) + #Use recalculated value for mixread param in case rw mode is not rw. + rwmixread=$MIX + if [[ $RW = *"read"* ]]; then + rwmixread=100 + elif [[ $RW = *"write"* ]]; then + rwmixread=0 + fi + iops_disks[$k]=$((iops_disks[k] + $(get_results iops $rwmixread))) + mean_lat_disks_usec[$k]=$((mean_lat_disks_usec[k] + $(get_results mean_lat_usec $rwmixread))) + p99_lat_disks_usec[$k]=$((p99_lat_disks_usec[k] + $(get_results p99_lat_usec $rwmixread))) + p99_99_lat_disks_usec[$k]=$((p99_99_lat_disks_usec[k] + $(get_results p99_99_lat_usec $rwmixread))) + stdev_disks_usec[$k]=$((stdev_disks_usec[k] + $(get_results stdev_usec $rwmixread))) + + mean_slat_disks_usec[$k]=$((mean_slat_disks_usec[k] + $(get_results mean_slat_usec $rwmixread))) + mean_clat_disks_usec[$k]=$((mean_clat_disks_usec[k] + $(get_results mean_clat_usec $rwmixread))) + bw[$k]=$((bw[k] + $(get_results bw_Kibs $rwmixread))) - mean_slat_disks_usec[$k]=$((${mean_slat_disks_usec[$k]} + $(get_results mean_slat_usec $MIX))) - mean_clat_disks_usec[$k]=$((${mean_clat_disks_usec[$k]} + $(get_results mean_clat_usec $MIX))) - bw[$k]=$((${bw[$k]} + $(get_results bw_Kibs $MIX))) cp $NVME_FIO_RESULTS $result_dir/perf_results_${MIX}_${PLUGIN}_${NO_CORES}cpus_${DATE}_${k}_disks_${j}.json cp $BASE_DIR/config.fio $result_dir/config_${MIX}_${PLUGIN}_${NO_CORES}cpus_${DATE}_${k}_disks_${j}.fio rm -f $BASE_DIR/config.fio