RSS

(root)/alps/fwbench : /fsbench.sh (revision 19)

To get this branch, use:
bzr branch /webbzr/alps/fwbench
Line Revision Contents
1 12
#! /bin/bash
2
3
DEVICE="/dev/md1"
4
WIDTH=32
5
CHUNK=64
6
FILE_SIZE=128 #1024
7
FAST_SPEED=3650
8
NUMA_CPU=4
9
PYHST="/root/pyhst/pyhst.sh"
10
PYHST_DATA="/home/csa/data/bench"
11
12
FS_LIST="ext4 xfs ext2 jfs reiserfs btrfs"
13
14
15
16
END_START=`expr $WIDTH '*' 2 - 2`
17
END_END=`expr $WIDTH '*' 2`
18
19
echo $DEVICE | grep "/dev/md" &> /dev/null
20
if [ $? -eq 0 ]; then SUFFIX="p"; else SUFFIX=""; fi
21
22
23
umount -l /mnt/slow &> /dev/null
24
umount -l /mnt/fast &> /dev/null
25
26
function partition {
27
    parted $DEVICE --script mklabel gpt
28
    parted $DEVICE --script rm 3 &> /dev/null
29
    parted $DEVICE --script rm 2 &> /dev/null
30
    parted $DEVICE --script rm 1 &> /dev/null
31
    parted $DEVICE --script mkpart primary 1GB 2TB
32
    parted $DEVICE --script mkpart primary ${END_START}TB ${END_END}TB
33
    parted $DEVICE --script mkpart primary 2TB 3TB
34
}
35
36
function format_ext4 {
37
    block=4 # in KB (4096)
38
    stride=`expr $CHUNK / $block`
39
    swidth=`expr $stride '*' $WIDTH`
40
    mkfs.ext4 -b 4096 -E stride=${stride},stripe-width=${swidth} $1 > /dev/null
41
    return 0
42
}
43
44
function format_ext2 {
45
    block=4 # in KB (4096)
46
    stride=`expr $CHUNK / $block`
47
    swidth=`expr $stride '*' $WIDTH`
48
    mkfs.ext2 -b 4096 -E stride=${stride},stripe-width=${swidth} $1 > /dev/null
49
    return 0
50
}
51
52
function format_xfs {
53
    mkfs.xfs -f -d su=${CHUNK}k,sw=${WIDTH} $1 > /dev/null
54
    mount -o noatime,allocsize=1GiB,largeio,swalloc $1 $2
55
    return 1
56
}
57
58
function format_xfsrt {
59
    mkfs.xfs -f -d su=${CHUNK}k,sw=${WIDTH} -r rtdev=$1,extsize=1g ${DEVICE}${SUFFIX}3 > /dev/null
60
    mount -o noatime,allocsize=1GiB,largeio,swalloc,rtdev=$1 ${DEVICE}${SUFFIX}3 $2
61
    return 1
62
}
63
64
function format_btrfs {
65
    sector=`expr $CHUNK '*' 1024`
66
#    mkfs.btrfs -s $sector -l $sector -n $sector $1 > /dev/null
67
    mkfs.btrfs $1 > /dev/null
68
    return 0
69
}
70
71
function format_jfs {
72
    mkfs.jfs -q $1 > /dev/null
73
    return 0
74
}
75
76
function format_reiserfs {
77
    mkfs.reiserfs -q $1 > /dev/null
78
    return 0
79
}
80
81
function bench_path {
82
    speed=$2
83
    res=`stdbuf -oL -eL ./fwbench.sh $1/testfile ${FILE_SIZE} $speed |tee /dev/stderr | tail -n 7 | sed  -e ':a;N;$!ba;s/\n/@eol@/g'`
84
    echo $res | sed -e 's/@eol@/\n/g'
85
    res=`echo $res | sed -e 's/@eol@/\n/g' | tail -n 1 |  cut -d ':' -f 2`
86
    if [ $res -gt 0 ]; then
87
	speed=$res
88
    fi
89
    stdbuf -oL -eL taskset -c $NUMA_CPU ./seqreader $1 | tee /dev/stderr | tail -n 5
90
}
91
92
function bench_device {
93
    speed=$2
94
    res=`stdbuf -oL -eL ./fwbench.sh $1 ${FILE_SIZE} $speed |tee /dev/stderr | tail -n 7 | sed  -e ':a;N;$!ba;s/\n/@eol@/g'`
95
    echo $res | sed -e 's/@eol@/\n/g'
96
    res=`echo $res | sed -e 's/@eol@/\n/g' | tail -n 1 |  cut -d ':' -f 2`
97
    if [ $res -gt 0 ]; then
98
	speed=$res
99
    fi
100
    stdbuf -oL -eL taskset -c $NUMA_CPU ./seqreader $1 ${FILE_SIZE} | tee /dev/stderr | tail -n 5
101
}
102
103
104
function bench_pyhst {
105
    data=$1/pyhst
106
    mkdir -p $data
107
    cat $PYHST_DATA/*.par | sed -e "s|@PATH@|$data|g" > $data/bench.par
108
    cp -r $PYHST_DATA/out_phase $data/
109
    echo 3 > /proc/sys/vm/drop_caches
110
    eval stdbuf -oL -eL $PYHST $data/bench.par 2>&1 | tee /dev/stderr | grep "Input/Output"
111
}
112
113
function test_fs {
114
    speed=`expr $FAST_SPEED + 50`
115
    formater="format_$1"
116
    eval $formater ${DEVICE}${SUFFIX}1 /mnt/fast
117
    if [ $? -eq 0 ]; then
118
	mount -o noatime ${DEVICE}${SUFFIX}1 /mnt/fast
119
    fi
120
    echo "Testing $1 (fast partition)"
121
    echo "=================================="
122
    bench_path /mnt/fast $speed
123
124
    echo
125
    echo "Testing $1 (PyHST)"
126
    echo "=================================="
127
    bench_pyhst /mnt/fast
128
129
    umount /mnt/fast
130
131
    echo
132
133
    eval $formater ${DEVICE}${SUFFIX}2 /mnt/slow
134
    if [ $? -eq 0 ]; then
135
	mount -o noatime ${DEVICE}${SUFFIX}2 /mnt/slow
136
    fi
137
    echo "Testing $1 (slow partition)"
138
    echo "=================================="
139
    bench_path /mnt/slow $speed
140
    umount /mnt/slow
141
    
142
    echo
143
    echo
144
}
145
146
function test_partition {
147
    speed=`expr $FAST_SPEED + 50`
148
    echo "Testing partition: $1"
149
    echo "=================================="
150
    bench_device $1 $speed
151
    echo
152
}
153
154
partition
155
test_partition ${DEVICE}
156
test_partition ${DEVICE}${SUFFIX}2
157
158
for fs in $FS_LIST; do
159
    test_fs $fs
160
done
161

Loggerhead 1.18.1 is a web-based interface for Bazaar branches