forked from ithewei/libhv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbenchmark.sh
executable file
·86 lines (69 loc) · 1.69 KB
/
benchmark.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
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
#!/bin/bash
host=127.0.0.1
port=2000
client=2
time=10
while getopts 'h:p:c:t:' opt
do
case $opt in
h) host=$OPTARG;;
p) port=$OPTARG;;
c) client=$OPTARG;;
t) time=$OPTARG;;
*) exit -1;;
esac
done
SCRIPT_DIR=$(cd `dirname $0`; pwd)
cd ${SCRIPT_DIR}/..
killall_echo_servers() {
#sudo killall libevent_echo libev_echo libuv_echo libhv_echo asio_echo poco_echo muduo_echo
if [ $(ps aux | grep _echo | grep -v grep | wc -l) -gt 0 ]; then
ps aux | grep _echo | grep -v grep | awk '{print $2}' | xargs sudo kill -9
fi
}
export LD_LIBRARY_PATH=lib:$LD_LIBRARY_PATH
killall_echo_servers
sport=$port
if [ -x bin/libevent_echo ]; then
let port++
bin/libevent_echo $port &
echo "libevent running on port $port"
fi
if [ -x bin/libev_echo ]; then
let port++
bin/libev_echo $port &
echo "libev running on port $port"
fi
if [ -x bin/libuv_echo ]; then
let port++
bin/libuv_echo $port &
echo "libuv running on port $port"
fi
if [ -x bin/libhv_echo ]; then
let port++
bin/libhv_echo $port &
echo "libhv running on port $port"
fi
if [ -x bin/asio_echo ]; then
let port++
bin/asio_echo $port &
echo "asio running on port $port"
fi
if [ -x bin/poco_echo ]; then
let port++
bin/poco_echo $port &
echo "poco running on port $port"
fi
if [ -x bin/muduo_echo ]; then
let port++
bin/muduo_echo $port &
echo "muduo running on port $port"
fi
sleep 1
for ((p=$sport+1; p<=$port; ++p)); do
echo -e "\n==============$p====================================="
# bin/webbench -q -c $client -t $time $host:$p
bin/pingpong_client -H $host -p $p
sleep 1
done
killall_echo_servers