blob: 752691856832622e7a206e4650d255644c16e8cb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
#!/bin/bash
set -o nounset
set -o errexit
set -o errtrace
set -o pipefail
BENCHDIR=$(dirname "$(readlink -f "$0")")
FILESYSTEMS="bcachefs bcachefs-no-checksum ext4 ext4-no-journal xfs btrfs"
#DEVS="/dev/rssda /dev/sdb /dev/sda5"
DEVS="/dev/nvme0n1"
BENCHES=$(cd $BENCHDIR/benches; echo *)
OUT=""
MNT=/mnt/run-benchmark
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
d)
DEVS=$OPTARG
;;
f)
FILESYSTEMS=$OPTARG
;;
b)
BENCHES=$OPTARG
;;
m)
MNT=$OPTARG
;;
o)
OUT=$OPTARG
;;
h)
usage
exit 0
;;
esac
done
shift $(( OPTIND - 1 ))
if [[ -z $DEVS ]]; then
echo "Required parameter -d missing: device(s) to test"
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
truncate --size 0 $terse
truncate --size 0 $full
echo "Test output in $OUT"
function cleanup {
umount $MNT > /dev/null 2>&1 || true
}
trap cleanup SIGINT SIGHUP SIGTERM EXIT
for dev in $DEVS; do
devname=$(basename $dev)
#model=$(hdparm -i $dev |tr ',' '\n'|sed -n 's/.*Model=\(.*\)/\1/p')
model=$(cat /sys/block/$devname/device/model)
echo "Device $devname ($model):" |tee -a $terse
for bench in $BENCHES; do
benchname=$(basename $bench)
echo " $benchname:" |tee -a $terse
for fs in $FILESYSTEMS; do
out=$OUT/$devname-$benchname-$fs
printf " %-16s" $fs: |tee -a $terse
$BENCHDIR/prep-benchmark-fs.sh -d $dev -m $MNT -f $fs >/dev/null 2>&1
sleep 10 # quiesce - SSDs are annoying
(cd $MNT; "$BENCHDIR/benches/$bench") > $out
umount $dev
echo "**** Device $devname ($model) filesystem $fs benchmark $benchname:" >> $full
cat $out >> $full
echo >> $full
sed -rne '/IOPS/ s/ +([[:alpha:]]+) ?:.*IOPS=([^,]+).*/\1 \2/ p' $out|
awk '{printf("%8s %8s iops", $1, $2)} END {printf("\n")}'|
tee -a $terse
done
done
done
|