-
Notifications
You must be signed in to change notification settings - Fork 0
/
bench.sh
48 lines (36 loc) · 872 Bytes
/
bench.sh
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
#!/bin/bash
LEDIS_PATH="/Users/holys/work/src/github.com/siddontang/ledisdb"
LEDIS_SERVER="ledis-server"
work() {
t1=$(date +"%s")
echo "##########$1############\n"
nohup ledis-server -config="$1.conf" &
sleep 2
pid=$(ps axu|grep -v grep |grep ledis-server | awk '{print $2}')
echo $pid
if [ "$2" == "write" ]; then
for i in {1..10}
do
date +"%Y/%m/%d %H:%M:%S"
echo "$i"000w
./benchmark -n=10000000 -type=write
ps -p $pid -o %cpu,%mem
iostat
echo "\n"
done
elif [ "$2" == "read" ]; then
./benchmark -count=20000 -type=read -n=100000000
ps -p $pid -o %cpu,%mem
iostat
echo "\n"
fi
t2=$(date +"%s")
delta=$(($t2-$t1))
echo "$1 used $delta seconds in total\n"
killall ledis-server
}
all() {
work leveldb $1
work rocksdb $1
}
all $1