summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2016-12-12 12:48:39 -0900
committerKent Overstreet <kent.overstreet@gmail.com>2016-12-12 12:48:39 -0900
commited0b2e3f2b098fb75b1a012214d5472c979213f0 (patch)
tree614e0505ccd7ea9a720b882119dbdb5f961e7866
parentce57f737388fc153f368a6081fd992f02a63506e (diff)
use sqlite for storing benchmark resultssqlite
-rwxr-xr-xbenches/dio-append-one-cpu2
-rwxr-xr-xbenches/dio-randread3
-rwxr-xr-xbenches/dio-randrw3
-rwxr-xr-xbenches/dio-randwrite21
-rwxr-xr-xbenches/dio-randwrite-unwritten3
-rwxr-xr-xprep-benchmark-fs.sh14
-rwxr-xr-xrun-benchmark.sh93
7 files changed, 69 insertions, 70 deletions
diff --git a/benches/dio-append-one-cpu b/benches/dio-append-one-cpu
index 4ecdf9f..2f0343c 100755
--- a/benches/dio-append-one-cpu
+++ b/benches/dio-append-one-cpu
@@ -11,4 +11,4 @@ fio --group_reporting \
--blocksize=4k \
--create_on_open=1 \
--file_append=1 \
- --cpus_allowed=4
+ --cpus_allowed=0
diff --git a/benches/dio-randread b/benches/dio-randread
index f935bfe..05faed9 100755
--- a/benches/dio-randread
+++ b/benches/dio-randread
@@ -8,4 +8,5 @@ fio --group_reporting \
--direct=1 \
--iodepth=64 \
--rw=randread \
- --blocksize=4k
+ --blocksize=4k \
+ --cpus_allowed=0
diff --git a/benches/dio-randrw b/benches/dio-randrw
index f39439e..98ec52a 100755
--- a/benches/dio-randrw
+++ b/benches/dio-randrw
@@ -8,4 +8,5 @@ fio --group_reporting \
--direct=1 \
--iodepth=60 \
--rw=randrw \
- --blocksize=4k
+ --blocksize=4k \
+ --cpus_allowed=0
diff --git a/benches/dio-randwrite b/benches/dio-randwrite
index 3dc5a68..27c55bb 100755
--- a/benches/dio-randwrite
+++ b/benches/dio-randwrite
@@ -1,12 +1,11 @@
-#!/bin/bash
-
-fio --group_reporting \
- --runtime=60 \
- --size=16G \
- --name=dio-randwrite \
- --ioengine=libaio \
- --direct=1 \
- --iodepth=64 \
- --rw=randwrite \
- --blocksize=4k \
+fio --group_reporting
+ --runtime=60
+ --size=16G
+ --name=dio-randwrite
+ --ioengine=libaio
+ --direct=1
+ --iodepth=64
+ --rw=randwrite
+ --blocksize=4k
+ --cpus_allowed=0
--overwrite=1
diff --git a/benches/dio-randwrite-unwritten b/benches/dio-randwrite-unwritten
index 2c4d1f8..fd770ef 100755
--- a/benches/dio-randwrite-unwritten
+++ b/benches/dio-randwrite-unwritten
@@ -8,4 +8,5 @@ fio --group_reporting \
--direct=1 \
--iodepth=64 \
--rw=randwrite \
- --blocksize=4k
+ --blocksize=4k \
+ --cpus_allowed=0
diff --git a/prep-benchmark-fs.sh b/prep-benchmark-fs.sh
index 3a46946..5339daf 100755
--- a/prep-benchmark-fs.sh
+++ b/prep-benchmark-fs.sh
@@ -23,17 +23,17 @@ while getopts "hd:m:f:" arg; do
esac
done
-if [[ -z $DEV ]]; then
+if [[ -z ${DEV-} ]]; then
echo "Required parameter -d missing: device to test"
exit 1
fi
-if [[ -z $MNT ]]; then
+if [[ -z ${MNT-} ]]; then
echo "Required parameter -m missing: mount point"
exit 1
fi
-if [[ -z $FS ]]; then
+if [[ -z ${FS-} ]]; then
echo "Required parameter -f missing: filesystem type"
exit 1
fi
@@ -45,13 +45,11 @@ blkdiscard -s $DEV >/dev/null 2>&1 ||
blkdiscard $DEV >/dev/null 2>&1 ||
true
+wipefs -af $DEV
+
case $FS in
bcache)
- wipefs -a $DEV
- bcache format \
- --error_action=panic \
- --data_csum_type=none \
- --cache $DEV
+ bcache format -f $DEV
;;
ext4)
mkfs.ext4 -F $DEV
diff --git a/run-benchmark.sh b/run-benchmark.sh
index 6643523..feecafe 100755
--- a/run-benchmark.sh
+++ b/run-benchmark.sh
@@ -5,31 +5,30 @@ set -o errexit
set -o errtrace
set -o pipefail
+# Benchmarks:
BENCHDIR=$(dirname "$(readlink -f "$0")")
+BENCHES=$(cd $BENCHDIR/benches; echo *)
+# Default options:
FILESYSTEMS="bcache ext4 ext4-no-journal xfs btrfs"
-DEVS="/dev/rssda /dev/sdb /dev/sda5"
-BENCHES=" \
- dio-randread \
- dio-randread-multithreaded \
- dio-randwrite \
- dio-randwrite-multithreaded \
- dio-randwrite-unwritten \
- dio-randwrite-multithreaded-unwritten \
- dio-randrw \
- dio-randrw-multithreaded \
- dio-append \
- dio-append-one-cpu \
- buffered-sync-append"
-OUT=""
+DEVS=""
MNT=/mnt/run-benchmark
+OUT=$(dirname "$(readlink -f "$0")")
+
+usage()
+{
+ echo "run-benchmark.sh - run benchmarks"
+ echo " -d devices to test"
+ echo " -f filesystems to test"
+ echo " -b benchmarks to run"
+ echo " -m mountpoint to use (default /mnt/run-benchmark)"
+ echo " -o benchmark output directory (default /root/results/<date>_\$i/"
+ echo " -h display this help and exit"
+ exit 0
+}
while getopts "hd:f:b:m:o:" arg; do
case $arg in
- h)
- usage
- exit 0
- ;;
d)
DEVS=$OPTARG
;;
@@ -45,6 +44,10 @@ while getopts "hd:f:b:m:o:" arg; do
o)
OUT=$OPTARG
;;
+ h)
+ usage
+ exit 0
+ ;;
esac
done
shift $(( OPTIND - 1 ))
@@ -54,48 +57,44 @@ if [[ -z $DEVS ]]; then
exit 1
fi
-if [[ -z $OUT ]]; then
- for i in `seq -w 0 100`; do
- OUT=/root/results/$(date -I)_$i
- [[ ! -e $OUT ]] && break
- done
-fi
-mkdir $OUT
-terse=$OUT/terse
-full=$OUT/full
+DB="$OUT/benchmark-results"
+LOGDIR="$OUT/benchmark-logs"
+mkdir -p "$OUT" "$LOGDIR" "$MNT"
+
+# Database schema:
+# date - date benchmark was run
+# version - kernel version or git sha1
+# fs - filesystem being tested
+# device - SSD/HDD model
+
+sqlite3 "$DB" "CREATE TABLE IF NOT EXISTS results(date, version, fs, device, benchmark_name, benchmark_cmd, output, logfile);"
-truncate --size 0 $terse
-truncate --size 0 $full
+function cleanup {
+ umount $MNT > /dev/null 2>&1 || true
+}
+trap cleanup SIGINT SIGHUP SIGTERM EXIT
-echo "Test output in $OUT:"
+benchmark_date=$(date)
+kernel_version=$(uname -r)
for dev in $DEVS; do
- devname=$(basename $dev)
model=$(hdparm -i $dev |tr ',' '\n'|sed -n 's/.*Model=\(.*\)/\1/p')
- echo "Device $devname ($model):" |tee -a $terse
-
for bench in $BENCHES; do
- benchname=$(basename $bench)
- echo " $benchname:" |tee -a $terse
+ benchmark_cmd=$(cat "$BENCHDIR/benches/$bench")
for fs in $FILESYSTEMS; do
- out=$OUT/$devname-$benchname-$fs
- printf " %-16s" $fs: |tee -a $terse
+ echo "Running $bench on $fs, $dev ($model)"
- $BENCHDIR/prep-benchmark-fs.sh -d $dev -m $MNT -f $fs >/dev/null 2>&1
- sleep 30 # quiesce
- (cd $MNT; "$BENCHDIR/benches/$bench") > $out
- umount $dev
+ $BENCHDIR/prep-benchmark-fs.sh -d $dev -m $MNT -f $fs #>/dev/null 2>&1
+ sleep 30 # quiesce - SSDs are annoying
- echo "**** Device $devname ($model) filesystem $fs benchmark $benchname:" >> $full
- cat $out >> $full
- echo >> $full
+ # run benchmark
+ results=$(cd $MNT; $benchmark_cmd)
+ umount $dev
- sed -rne '/iops/ s/ +([[:alpha:]]+) ?:.*iops=([0-9]+).*/\1 \2/ p' $out|
- awk '{printf("%8s %8d iops", $1, $2)} END {printf("\n")}'|
- tee -a $terse
+ sqlite3 "$DB" "INSERT INTO results values($benchmark_date, $kernel_version, $fs, $model, $bench, $benchmark_cmd, $results, \"\");"
done
done
done