mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-14 09:11:27 +00:00
Various improvements:
- Display a clear warning if the user running this script does not have sufficient privileges to drop the VM caches. - Made sure that header and data columns are aligned if dd reports an error, e.g. when trying to perform direct I/O on a device that does not support direct I/O. - Made sure that header and data columns are aligned when running a read-only test (-r). git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@961 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -38,7 +38,7 @@ usage() {
|
||||
echo " <dev> - block device to run the I/O performance test on."
|
||||
}
|
||||
|
||||
# Echo ((2**$1))
|
||||
# Compute two raised to the power $1.
|
||||
pow2() {
|
||||
if [ $1 = 0 ]; then
|
||||
echo 1
|
||||
@@ -47,9 +47,15 @@ pow2() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Report via the exit status whether or not the current user has sufficient
|
||||
# privileges to drop the VM caches.
|
||||
can_drop_cache() {
|
||||
[ -w /proc/sys/vm/drop_caches ]
|
||||
}
|
||||
|
||||
drop_caches() {
|
||||
sync
|
||||
if [ -w /proc/sys/vm/drop_caches ]; then
|
||||
if can_drop_cache; then
|
||||
echo 3 > /proc/sys/vm/drop_caches
|
||||
fi
|
||||
if [ "${target_login}" != "" ]; then
|
||||
@@ -128,6 +134,13 @@ then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! can_drop_cache; then
|
||||
echo ""
|
||||
echo "WARNING: insufficient privileges to drop the file system cache"
|
||||
echo "-- results will be unreliable."
|
||||
echo ""
|
||||
fi
|
||||
|
||||
if [ "${iotype}" = "direct" ]; then
|
||||
dd_oflags="oflag=direct conv=notrunc"
|
||||
dd_iflags="iflag=direct"
|
||||
@@ -191,9 +204,9 @@ do
|
||||
drop_caches
|
||||
dd if=/dev/zero of="${device}" bs=${bs} count=${count} \
|
||||
${dd_oflags} 2>&1 \
|
||||
| sed -n 's/.* \([0-9.]*\) s,.*/\1/p'
|
||||
| sed -n -e 's/.* \([0-9.]*\) s,.*/\1/p' -e 's/^dd: .*/0/p'
|
||||
else
|
||||
echo 0
|
||||
echo " 0 s,"
|
||||
fi
|
||||
i=$((i+1))
|
||||
done | echo_and_calc_avg "%8.3f " ${iosize} ${bs}
|
||||
@@ -204,7 +217,7 @@ do
|
||||
drop_caches
|
||||
dd if="${device}" of=/dev/null bs=${bs} count=${count} \
|
||||
${dd_iflags} 2>&1 \
|
||||
| sed -n 's/.* \([0-9.]*\) s,.*/\1/p'
|
||||
| sed -n -e 's/.* \([0-9.]*\) s,.*/\1/p' -e 's/^dd: .*/0/p'
|
||||
i=$((i+1))
|
||||
done | echo_and_calc_avg "%8.3f " ${iosize} ${bs}
|
||||
printf "\n"
|
||||
|
||||
Reference in New Issue
Block a user