-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.sh
executable file
·59 lines (51 loc) · 1.58 KB
/
run.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
#!/bin/bash
set -e
SERVER_HOST=192.168.200.101
SERVER_PORT=11211
# NOTE: Experiment duration in seconds
TIME=10
LOCALHOST=`hostname`
# NOTE: if REMOTEHOST is not set then it is not configured and REMOTECMD is not
# executed
REMOTEHOST=$LOCALHOST
# NOTE: RUNLOCAL can be `master` or `agent`. It decides if master or agent node
# should run locally
RUNLOCAL=master
AGENT_CMDLINE='./mutilateudp -A --threads 4'
MASTER_CMDLINE='./mutilateudp --records=1000000 --time=$TIME --qps=10000
--keysize=fb_key --valuesize=fb_value --iadist=fb_ia --update=0
--server=$SERVER_HOST:$SERVER_PORT --noload --threads=1
--connections=4 --measure_connections=32
--measure_qps=2000 --binary --agent=$AGENT'
if [ $RUNLOCAL == agent ]; then
AGENT=$LOCALHOST
LOCALCMD=$AGENT_CMDLINE
REMOTECMD=`eval echo $MASTER_CMDLINE`
elif [ $RUNLOCAL == master ]; then
AGENT=$REMOTEHOST
LOCALCMD=`eval echo $MASTER_CMDLINE`
REMOTECMD=$AGENT_CMDLINE
fi
REMOTEBIN=${REMOTECMD/%\ */}
REMOTEBIN=${REMOTEBIN:2}
echo -e "\033[32m --- Run local: $LOCALCMD\033[0m"
if [ "x$REMOTEHOST" != "x" ]; then
echo -e "\033[32m --- Run remote: $REMOTECMD\033[0m"
else
echo -e "\033[32m --- Run remote: not configured\033[0m"
fi
# Compile mutilate if it is not compiled yet
scons
if [ "x$REMOTEHOST" != "x" ]; then
# Configure and run the remote node
trap 'ssh $REMOTEHOST pkill $REMOTEBIN' EXIT
scp -q $REMOTEBIN $REMOTEHOST:
ssh $REMOTEHOST "ulimit -c unlimited; stdbuf -oL $REMOTECMD" &
fi
if [ x$1 == x -o x$1 == xrun ]; then
$LOCALCMD
elif [ $1 == strace ]; then
strace -e '!epoll_wait' -f $LOCALCMD
elif [ $1 == gdb ]; then
gdb --args $LOCALCMD
fi