blob: 9dcfe8c213ebf167b7184f4df8e3cd99b65e3be4 (
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
|
#!/bin/bash
#
set -e
usage() {
cat <<EOF
usage: $0 <perftest-args> --pubhosts <publish-hosts> --subhosts <subscribe-hosts>
All perftest args must come before --pubhost or --subhost. Runs one
publish process on each publish-host, one subscribe process on each
subscribe-host. To run multiple processes on the same host, list it
more than once.
Do not pass action flags --setup, --control, --publish, --subscribe they
will be passed to the appropriate processes.
Do not pass --nsubs or --npubs, they are calculated by counting the host lists.
EOF
exit 1
}
while test $# -gt 0; do
case $1 in
--publish|--subscribe|--setup|--control|--npubs|--nsubs) usage ;;
--pubhosts) COLLECT=PUBHOSTS; shift; break ;;
--subhosts) COLLECT=SUBHOSTS; shift; break ;;
*) ARGS="$ARGS $1"; shift ;;
esac
done
if [ -z "$COLLECT" ]; then echo "No --pubhost or --subhost specified"; usage; fi
while test $# -gt 0; do
case $1 in
--pubhosts) COLLECT=PUBHOSTS; shift ;;
--subhosts) COLLECT=SUBHOSTS; shift ;;
*) eval "$COLLECT=\"\$$COLLECT $1\""; shift ;;
esac
done
if [ -z "$PUBHOSTS" ]; then echo "Missing --pubhost or --subhost"; usage; fi
if [ -z "$SUBHOSTS" ]; then echo "Missing --subhost or --subhost"; usage; fi
NPUBS=`echo $PUBHOSTS | wc -w`
NSUBS=`echo $SUBHOSTS | wc -w`
ARGS="$ARGS --npubs $NPUBS --nsubs $NSUBS"
PERFTEST="`PATH=$PWD:$PATH which perftest` $ARGS"
start() {
ssh $2 $PERFTEST --$1
}
$PERFTEST --setup
for h in $PUBHOSTS; do start publish $h & done
for h in $SUBHOSTS; do start subscribe $h & done
$PERFTEST --control
|