Check for GNU dd (→ FreeBSD)
This commit is contained in:
parent
5a40c0eaf7
commit
b02244c14b
41
nench.sh
41
nench.sh
@ -95,6 +95,24 @@ then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if command_exists gdd
|
||||||
|
then
|
||||||
|
gnu_dd='gdd'
|
||||||
|
elif command_exists dd
|
||||||
|
then
|
||||||
|
gnu_dd='dd'
|
||||||
|
else
|
||||||
|
printf '%s\n' 'This script requires dd, but it could not be found.' 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! "$gnu_dd" --version > /dev/null 2>&1
|
||||||
|
then
|
||||||
|
printf '%s\n' 'It seems your system only has a non-GNU version of dd.'
|
||||||
|
printf '%s\n' 'dd write tests disabled.'
|
||||||
|
gnu_dd=''
|
||||||
|
fi
|
||||||
|
|
||||||
printf '%s\n' '-------------------------------------------------'
|
printf '%s\n' '-------------------------------------------------'
|
||||||
printf ' nench.sh v2017.05.08 -- https://git.io/nench.sh\n'
|
printf ' nench.sh v2017.05.08 -- https://git.io/nench.sh\n'
|
||||||
date -u '+ benchmark timestamp: %F %T UTC'
|
date -u '+ benchmark timestamp: %F %T UTC'
|
||||||
@ -157,18 +175,23 @@ printf '\n'
|
|||||||
# dd disk test
|
# dd disk test
|
||||||
printf 'dd test\n'
|
printf 'dd test\n'
|
||||||
|
|
||||||
io1=$( dd_benchmark )
|
if [ -z "$gnu_dd" ]
|
||||||
printf ' 1st run: %s\n' "$(printf '%d\n' "$io1" | Bps_to_MiBps)"
|
then
|
||||||
|
printf ' %s\n' '[disabled due to missing GNU dd]'
|
||||||
|
else
|
||||||
|
io1=$( dd_benchmark )
|
||||||
|
printf ' 1st run: %s\n' "$(printf '%d\n' "$io1" | Bps_to_MiBps)"
|
||||||
|
|
||||||
io2=$( dd_benchmark )
|
io2=$( dd_benchmark )
|
||||||
printf ' 2nd run: %s\n' "$(printf '%d\n' "$io2" | Bps_to_MiBps)"
|
printf ' 2nd run: %s\n' "$(printf '%d\n' "$io2" | Bps_to_MiBps)"
|
||||||
|
|
||||||
io3=$( dd_benchmark )
|
io3=$( dd_benchmark )
|
||||||
printf ' 3rd run: %s\n' "$(printf '%d\n' "$io3" | Bps_to_MiBps)"
|
printf ' 3rd run: %s\n' "$(printf '%d\n' "$io3" | Bps_to_MiBps)"
|
||||||
|
|
||||||
# Calculating avg I/O (better approach with awk for non int values)
|
# Calculating avg I/O (better approach with awk for non int values)
|
||||||
ioavg=$( awk 'BEGIN{print int(('"$io1"' + '"$io2"' + '"$io3"')/3)}' )
|
ioavg=$( awk 'BEGIN{print int(('"$io1"' + '"$io2"' + '"$io3"')/3)}' )
|
||||||
printf ' average: %s\n' "$(printf '%d\n' "$ioavg" | Bps_to_MiBps)"
|
printf ' average: %s\n' "$(printf '%d\n' "$ioavg" | Bps_to_MiBps)"
|
||||||
|
fi
|
||||||
|
|
||||||
printf '\n'
|
printf '\n'
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user