summaryrefslogtreecommitdiffstats
path: root/dev-tools
diff options
context:
space:
mode:
authorjandob2016-02-11 14:55:45 +0100
committerjandob2016-02-11 14:55:45 +0100
commit3bafe05d00cf6c9b7dd95f95591ece6224c0db49 (patch)
tree78c11ece682401131f9acd6c4eacaf2207a622ee /dev-tools
parentRebash update. (diff)
downloadsystemd-init-3bafe05d00cf6c9b7dd95f95591ece6224c0db49.tar.gz
systemd-init-3bafe05d00cf6c9b7dd95f95591ece6224c0db49.tar.xz
systemd-init-3bafe05d00cf6c9b7dd95f95591ece6224c0db49.zip
add io_test.sh
Diffstat (limited to 'dev-tools')
-rwxr-xr-xdev-tools/io_test.sh105
1 files changed, 105 insertions, 0 deletions
diff --git a/dev-tools/io_test.sh b/dev-tools/io_test.sh
new file mode 100755
index 00000000..d511ee86
--- /dev/null
+++ b/dev-tools/io_test.sh
@@ -0,0 +1,105 @@
+#image="$(realpath "$1")"
+image="/home/h4ct1c/git/masterteamprojekt/dnbd3_images/archLinux/archLinux.vdi.r10"
+test_directory=/tmp/performance_test
+[ ! -z $2 ] && test_directory="$2"
+
+image_directory="$(dirname "$image")"
+dnbd3_rootfs_directory="../builder/dnbd3-rootfs"
+log_directory="./io_test_logs"
+mountpoint_xmount="${test_directory}/mnt_xmount"
+mountpoint="${test_directory}/mnt"
+
+
+source ${dnbd3_rootfs_directory}/scripts/build.sh
+
+if [[ ! -d "$test_directory" ]]; then
+ mkdir "$test_directory"
+ mkdir "$mountpoint_xmount"
+ mkdir "$mountpoint"
+ mkdir "$log_directory"
+
+ build_clean_xmount ${dnbd3_rootfs_directory}/binaries/xmount
+ build_clean_qemu_xmount ${dnbd3_rootfs_directory}/binaries/qemu-xmount
+
+ build_compile_xmount ${dnbd3_rootfs_directory}/binaries/xmount \
+ "/" "${test_directory}/xmount"
+ build_compile_qemu_xmount ${dnbd3_rootfs_directory}/binaries/qemu-xmount \
+ "${test_directory}/xmount"
+ cp ${dnbd3_rootfs_directory}/binaries/qemu-xmount/libxmount_input_qemu.so \
+ "${test_directory}/xmount/lib/xmount/"
+fi
+
+pushd "$log_directory"
+
+dd_test() {
+ local device="$1"
+ size_in_megabyte="$2"
+ dd if="$device" of=/dev/null \
+ bs="$size_in_megabyte"M count=1\
+ iflag=direct \
+ 2>&1 | grep bytes
+}
+fio_test() {
+ local device="$1"
+ shift
+ local name="$1"
+ shift
+ fio --readonly --name=hans --direct=1 --write_bw_log="$name" \
+ --size=2G --filename="$device" $@
+}
+test_device() {
+ local device="$1"
+ local name="$2"
+ echo
+
+ #echo "-------------- $2 read test (dd)"
+ #dd_test "$device" 1000
+
+ #echo "-------------- $2 read test (fio)"
+ #fio_test "$device" "$name" --rw=read
+
+ echo "-------------- $2 read test (fio random read)"
+ fio_test "$device" "${name}.rand" --rw=randread
+
+ #echo "-------------- $2 read test (fio random read libaio)"
+ #fio_test "$device" "${name}.rand,libaio" --rw=randread --ioengine=libaio
+
+ #echo "-------------- $2 read test (find)"
+ #mount -o ro "$device"p2 "$mountpoint"
+ #(time find "$mountpoint" 1>/dev/null) 2>&1 | grep -E 'user|sys'
+ #umount "$mountpoint"
+}
+test_qemu() {
+ # qemu-nbd test (no cache)
+ modprobe nbd max_part=16
+ qemu-nbd --connect=/dev/nbd0 --read-only --persistent --nocache "$image"
+ #ln -s /dev/nbd0 "$image" # device as file (for dnbd3)
+ test_device "/dev/nbd0" "qemu-nbd (nocache)"
+ # qemu-nbd teardown
+ qemu-nbd -d /dev/nbd0 >/dev/null # disconnect
+
+ # qemu-nbd test
+ qemu-nbd --connect=/dev/nbd0 --read-only --persistent "$image"
+ test_device "/dev/nbd0" "qemu-nbd"
+ # qemu-nbd teardown
+ qemu-nbd -d /dev/nbd0 >/dev/null # disconnect
+}
+
+test_xmount() {
+ #xmount test
+ ${test_directory}/xmount/bin/xmount --in qemu "$image" \
+ --out raw "${mountpoint_xmount}"
+ loop_device="$(losetup -f)"
+ losetup "$loop_device" "${mountpoint_xmount}"/*.dd --partscan
+ test_device "$loop_device" "xmount"
+
+ # xmount teardown
+ losetup -d "$loop_device"
+ umount "$mountpoint_xmount"
+}
+
+test_qemu
+test_xmount
+chown $(who | awk '{print $1}') *.log
+fio2gnuplot -b -g
+popd