mirror of
https://github.com/SCST-project/scst.git
synced 2026-09-24 08:54:16 +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 " <dev> - block device to run the I/O performance test on."
|
||||||
}
|
}
|
||||||
|
|
||||||
# Echo ((2**$1))
|
# Compute two raised to the power $1.
|
||||||
pow2() {
|
pow2() {
|
||||||
if [ $1 = 0 ]; then
|
if [ $1 = 0 ]; then
|
||||||
echo 1
|
echo 1
|
||||||
@@ -47,9 +47,15 @@ pow2() {
|
|||||||
fi
|
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() {
|
drop_caches() {
|
||||||
sync
|
sync
|
||||||
if [ -w /proc/sys/vm/drop_caches ]; then
|
if can_drop_cache; then
|
||||||
echo 3 > /proc/sys/vm/drop_caches
|
echo 3 > /proc/sys/vm/drop_caches
|
||||||
fi
|
fi
|
||||||
if [ "${target_login}" != "" ]; then
|
if [ "${target_login}" != "" ]; then
|
||||||
@@ -128,6 +134,13 @@ then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
if [ "${iotype}" = "direct" ]; then
|
||||||
dd_oflags="oflag=direct conv=notrunc"
|
dd_oflags="oflag=direct conv=notrunc"
|
||||||
dd_iflags="iflag=direct"
|
dd_iflags="iflag=direct"
|
||||||
@@ -191,9 +204,9 @@ do
|
|||||||
drop_caches
|
drop_caches
|
||||||
dd if=/dev/zero of="${device}" bs=${bs} count=${count} \
|
dd if=/dev/zero of="${device}" bs=${bs} count=${count} \
|
||||||
${dd_oflags} 2>&1 \
|
${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
|
else
|
||||||
echo 0
|
echo " 0 s,"
|
||||||
fi
|
fi
|
||||||
i=$((i+1))
|
i=$((i+1))
|
||||||
done | echo_and_calc_avg "%8.3f " ${iosize} ${bs}
|
done | echo_and_calc_avg "%8.3f " ${iosize} ${bs}
|
||||||
@@ -204,7 +217,7 @@ do
|
|||||||
drop_caches
|
drop_caches
|
||||||
dd if="${device}" of=/dev/null bs=${bs} count=${count} \
|
dd if="${device}" of=/dev/null bs=${bs} count=${count} \
|
||||||
${dd_iflags} 2>&1 \
|
${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))
|
i=$((i+1))
|
||||||
done | echo_and_calc_avg "%8.3f " ${iosize} ${bs}
|
done | echo_and_calc_avg "%8.3f " ${iosize} ${bs}
|
||||||
printf "\n"
|
printf "\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user