mirror of
https://github.com/masonr/yet-another-bench-script.git
synced 2025-11-05 23:41:30 +05:30
Added locale override for dd to parse output reliably
This commit is contained in:
parent
20846f0816
commit
dd591b9251
1 changed files with 2 additions and 2 deletions
4
yabs.sh
4
yabs.sh
|
|
@ -89,14 +89,14 @@ function disk_test {
|
|||
while [ $I -lt 3 ]
|
||||
do
|
||||
# write test using dd, "direct" flag is used to test direct I/O for data being stored to disk
|
||||
DISK_WRITE_TEST=$(dd if=/dev/zero of=$DISK_PATH/$DATE.test bs=64k count=16k oflag=direct |& grep copied | awk '{ print $(NF-1) " " $(NF)}')
|
||||
DISK_WRITE_TEST=$(LC_ALL=C dd if=/dev/zero of=$DISK_PATH/$DATE.test bs=64k count=16k oflag=direct |& grep copied | awk '{ print $(NF-1) " " $(NF)}')
|
||||
VAL=$(echo $DISK_WRITE_TEST | cut -d " " -f 1)
|
||||
[[ "$DISK_WRITE_TEST" == *"GB"* ]] && VAL=$(awk -v a="$VAL" 'BEGIN { print a * 1000 }')
|
||||
DISK_WRITE_TEST_RES+=( "$DISK_WRITE_TEST" )
|
||||
DISK_WRITE_TEST_AVG=$(awk -v a="$DISK_WRITE_TEST_AVG" -v b="$VAL" 'BEGIN { print a + b }')
|
||||
|
||||
# read test using dd using the 1G file written during the write test
|
||||
DISK_READ_TEST=$(dd if=$DISK_PATH/$DATE.test of=/dev/null bs=8k |& grep copied | awk '{ print $(NF-1) " " $(NF)}')
|
||||
DISK_READ_TEST=$(LC_ALL=C dd if=$DISK_PATH/$DATE.test of=/dev/null bs=8k |& grep copied | awk '{ print $(NF-1) " " $(NF)}')
|
||||
VAL=$(echo $DISK_READ_TEST | cut -d " " -f 1)
|
||||
[[ "$DISK_READ_TEST" == *"GB"* ]] && VAL=$(awk -v a="$VAL" 'BEGIN { print a * 1000 }')
|
||||
DISK_READ_TEST_RES+=( "$DISK_READ_TEST" )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue