Skip to content

Commit

Permalink
Fix display issues with test units
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRemote committed Nov 26, 2023
1 parent 7705371 commit 8008745
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ These are iozone and fio which are both benchmarking utilities and should be saf
<ul>
<li>Added export LC_ALL=C to top of script to prevent language related issues on some systems</li>
<li>Fix null bytes breaking test_nvme</li>
<li>Fixed display issue with DD and HDParm tests showing the wrong units on very slow or very fast machines</li>
</ul>

<h3>January 1st 2023</h3>
Expand Down
13 changes: 8 additions & 5 deletions Storage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -850,18 +850,21 @@ if [ -z "$HDParm" ]; then
fi
Print_Style "$HDParm" "$NORMAL"
HDParmDisk=$(echo "$HDParm" | grep "disk reads:" | awk 'NR==1{ print $11 }' | sed 's/;/!/g')
HDParmDiskUnit=$(echo "$HDParm" | grep "disk reads:" | awk 'NR==1{ print $12 }' | sed 's/;/!/g')
HDParmCached=$(echo "$HDParm" | grep "cached reads:" | awk 'NR==1{ print $11 }' | sed 's/;/!/g')
Print_Style "HDParm: $HDParmDisk MB/s - HDParmCached: $HDParmCached MB/s" "$YELLOW"
HDParmCachedUnit=$(echo "$HDParm" | grep "disk reads:" | awk 'NR==1{ print $12 }' | sed 's/;/!/g')
Print_Style "HDParm: $HDParmDisk $HDParmDiskUnit - HDParmCached: $HDParmCached $HDParmCachedUnit" "$YELLOW"

# Run DD tests
Print_Style "Running dd tests ..." "$YELLOW"
sync
sync
DDWrite=$(dd if=/dev/zero of=test bs=4k count=130k conv=fsync 2>&1 | sed '/^[[:space:]]*$/d')
DDWriteResult=$(echo "$DDWrite" | tail -n 1 | awk 'NR==1{ print $(NF-1) }' | sed 's/,/./g' | sed 's/s,//g')
DDWriteUnit=$(echo "$DDWrite" | tail -n 1 | awk 'NR==1{ print $(NF) }' | sed 's/,/./g' | sed 's/s,//g')

echo "$DDWrite"
Print_Style "DD Write Speed: $DDWriteResult MB/s" "$YELLOW"
Print_Style "DD Write Speed: $DDWriteResult $DDWriteUnit" "$YELLOW"
rm -f test

# Run fio tests
Expand Down Expand Up @@ -940,9 +943,9 @@ Score=$(echo "scale=0; $Score / 100" | bc)

# Display results
printf "\n$BRIGHT$UNDERLINE%-25s %-25s %-25s\n" " Category" " Test" ' Result '"$NORMAL$CYAN"
printf "%-25s %-25s %-25s\n" "HDParm" "Disk Read" "$HDParmDisk MB/s"
printf "%-25s %-25s %-25s\n" "HDParm" "Cached Disk Read" "$HDParmCached MB/s"
printf "%-25s %-25s %-25s\n" "DD" "Disk Write" "$DDWriteResult MB/s"
printf "%-25s %-25s %-25s\n" "HDParm" "Disk Read" "$HDParmDisk $HDParmDiskUnit"
printf "%-25s %-25s %-25s\n" "HDParm" "Cached Disk Read" "$HDParmCached $HDParmCachedUnit"
printf "%-25s %-25s %-25s\n" "DD" "Disk Write" "$DDWriteResult $DDWriteUnit"
printf "%-25s %-25s %-25s\n" "FIO" "4k random read" "$fio4kRandReadIOPS IOPS ($fio4kRandReadSpeed KB/s)"
printf "%-25s %-25s %-25s\n" "FIO" "4k random write" "$fio4kRandWriteIOPS IOPS ($fio4kRandWriteSpeed KB/s)"
printf "%-25s %-25s %-25s\n" "IOZone" "4k read" "$IO4kRead KB/s"
Expand Down

0 comments on commit 8008745

Please sign in to comment.