2019-01-17 19:14:45 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-01-21 17:22:21 +01:00
|
|
|
usage () {
|
|
|
|
cat >&2 <<EOF
|
|
|
|
usage: $0 [OPTIONS] user@remote [user@remote...]
|
2019-01-17 19:14:45 +01:00
|
|
|
|
2019-01-21 17:22:21 +01:00
|
|
|
OPTIONS
|
|
|
|
-i IF use network interface IF (default: eth0)
|
|
|
|
-b 100|1000 network bandwidth (100Mbps/1000Gbps) for calculating load
|
|
|
|
% given load in bytes/second (default: 1000)
|
|
|
|
-d DIR use DIR on remote (default: PWD)
|
|
|
|
-p provision required binaries in DIR (default: false)
|
|
|
|
first ssh's in to try mkdir -p DIR, then follows up with scp
|
|
|
|
-t DUR run for DUR seconds per size (default 20)
|
|
|
|
-a ASYNCLIST run for delivery async settings ASYNCLIST (default: "0 1")
|
|
|
|
-m MODELIST run with subscriber mode settings MODELIST (default: "-1 0 1")
|
|
|
|
-s SIZELIST run for sizes in SIZELIST (default: "0 16 32 64 128 256")
|
|
|
|
-l LOOPBACK enable/disable multicast loopback (true/false, default: true)
|
|
|
|
-o DIR store results in dir (default: throughput-result)
|
|
|
|
|
|
|
|
Local host runs ThroughputSubscriber, first remote runs ThroughputPublisher,
|
|
|
|
further remotes also run ThroughputSubscriber. It assumes these are
|
|
|
|
available in DIR/bin. It also assumes that ssh user@remote works without
|
|
|
|
requiring a password.
|
2019-01-17 19:14:45 +01:00
|
|
|
EOF
|
|
|
|
exit 1
|
2019-01-21 17:22:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export nwif=eth0
|
|
|
|
bandwidth=1000
|
|
|
|
remotedir="$PWD"
|
|
|
|
provision=false
|
|
|
|
asynclist="0 1"
|
|
|
|
modelist="-1 0 1"
|
|
|
|
sizelist="0 16 32 64 128 256"
|
|
|
|
timeout=20
|
|
|
|
loopback=true
|
|
|
|
resultdir="throughput-result"
|
|
|
|
while getopts "i:b:d:pa:m:s:t:o:l:" opt ; do
|
|
|
|
case $opt in
|
|
|
|
i) nwif="$OPTARG" ;;
|
|
|
|
b) bandwidth="$OPTARG" ;;
|
|
|
|
d) remotedir="$OPTARG" ;;
|
|
|
|
p) provision=true ;;
|
|
|
|
a) asynclist="$OPTARG" ;;
|
|
|
|
m) modelist="$OPTARG" ;;
|
|
|
|
s) sizelist="$OPTARG" ;;
|
|
|
|
l) loopback="OPTARG" ;;
|
|
|
|
t) timeout="$OPTARG" ;;
|
|
|
|
o) resultdir="$OPTARG" ;;
|
|
|
|
h) usage ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
shift $((OPTIND-1))
|
|
|
|
if [ $# -lt 1 ] ; then usage ; fi
|
|
|
|
ethload=`dirname $0`/ethload
|
|
|
|
pubremote=$1
|
|
|
|
shift
|
2019-01-17 19:14:45 +01:00
|
|
|
|
|
|
|
cfg=cdds-simple.xml
|
|
|
|
cat >$cfg <<EOF
|
|
|
|
<CycloneDDS>
|
|
|
|
<Domain>
|
|
|
|
<Id>17</Id>
|
|
|
|
</Domain>
|
|
|
|
<DDSI2E>
|
|
|
|
<General>
|
2019-01-21 17:22:21 +01:00
|
|
|
<NetworkInterfaceAddress>$nwif</NetworkInterfaceAddress>
|
|
|
|
<EnableMulticastLoopback>$loopback</EnableMulticastLoopback>
|
2019-01-17 19:14:45 +01:00
|
|
|
</General>
|
|
|
|
<Internal>
|
|
|
|
<Watermarks>
|
|
|
|
<WhcHigh>500kB</WhcHigh>
|
|
|
|
</Watermarks>
|
2019-01-21 17:22:21 +01:00
|
|
|
<SynchronousDeliveryPriorityThreshold>${async:-0}</SynchronousDeliveryPriorityThreshold>
|
|
|
|
<LeaseDuration>3s</LeaseDuration>
|
2019-01-17 19:14:45 +01:00
|
|
|
</Internal>
|
|
|
|
</DDSI2E>
|
|
|
|
</CycloneDDS>
|
|
|
|
EOF
|
|
|
|
|
|
|
|
if [ ! -x bin/ThroughputPublisher -o ! -x bin/ThroughputSubscriber -o ! -x $ethload ] ; then
|
|
|
|
echo "some check for existence of a file failed on the local machine" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-01-21 17:22:21 +01:00
|
|
|
[ -d $resultdir ] || { echo "output directory $resultdir doesn't exist" >&2 ; exit 1 ; }
|
|
|
|
|
|
|
|
if $provision ; then
|
|
|
|
echo "provisioning ..."
|
|
|
|
for r in $pubremote "$@" ; do
|
|
|
|
ssh $r mkdir -p $remotedir $remotedir/bin $remotedir/lib
|
|
|
|
scp lib/libddsc.so.0 $r:$remotedir/lib
|
|
|
|
scp bin/ThroughputPublisher bin/ThroughputSubscriber $r:$remotedir/bin
|
|
|
|
done
|
|
|
|
fi
|
2019-01-17 19:14:45 +01:00
|
|
|
|
|
|
|
export CYCLONEDDS_URI=file://$PWD/$cfg
|
2019-01-21 17:22:21 +01:00
|
|
|
for r in $pubremote "$@" ; do
|
|
|
|
scp $cfg $r:$remotedir || { echo "failed to copy $cfg to $remote:$PWD" >&2 ; exit 1 ; }
|
|
|
|
done
|
2019-01-17 19:14:45 +01:00
|
|
|
|
2019-01-21 17:22:21 +01:00
|
|
|
for async in $asynclist ; do
|
|
|
|
export async
|
|
|
|
for mode in $modelist ; do
|
2019-01-17 19:14:45 +01:00
|
|
|
echo "======== ASYNC $async MODE $mode ========="
|
2019-01-21 17:22:21 +01:00
|
|
|
|
2019-01-17 19:14:45 +01:00
|
|
|
cat > run-publisher.tmp <<EOF
|
2019-01-21 17:22:21 +01:00
|
|
|
export CYCLONEDDS_URI=file://$remotedir/$cfg
|
|
|
|
export async=$async
|
|
|
|
cd $remotedir
|
2019-01-17 19:14:45 +01:00
|
|
|
rm -f pub-top.log
|
2019-01-21 17:22:21 +01:00
|
|
|
for size in $sizelist ; do
|
2019-01-17 19:14:45 +01:00
|
|
|
echo "size \$size"
|
|
|
|
bin/ThroughputPublisher \$size > pub.log & ppid=\$!
|
|
|
|
top -b -d1 -p \$ppid >> pub-top.log & tpid=\$!
|
2019-01-21 17:22:21 +01:00
|
|
|
sleep $timeout
|
2019-01-17 19:14:45 +01:00
|
|
|
kill \$tpid
|
|
|
|
kill -2 \$ppid
|
|
|
|
wait \$ppid
|
|
|
|
sleep 5
|
|
|
|
done
|
|
|
|
wait
|
|
|
|
EOF
|
2019-01-21 17:22:21 +01:00
|
|
|
scp run-publisher.tmp $pubremote:$remotedir || { echo "failed to copy $cfg to $remote:$PWD" >&2 ; exit 2 ; }
|
|
|
|
killremotesubs=""
|
|
|
|
if [ $# -gt 0 ] ; then
|
|
|
|
cat > run-subscriber.tmp <<EOF
|
|
|
|
export CYCLONEDDS_URI=file://$remotedir/$cfg
|
|
|
|
export async=$async
|
|
|
|
cd $remotedir
|
|
|
|
nohup bin/ThroughputSubscriber 0 $mode > /dev/null &
|
|
|
|
echo \$!
|
|
|
|
EOF
|
|
|
|
for r in "$@" ; do
|
|
|
|
scp run-subscriber.tmp $r:$remotedir
|
|
|
|
rsubpid=`ssh $r ". $remotedir/run-subscriber.tmp"`
|
|
|
|
killremotesubs="$killremotesubs ssh $r kill -9 $rsubpid &"
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
outdir=$resultdir/data-async$async-mode$mode
|
2019-01-17 19:14:45 +01:00
|
|
|
mkdir $outdir
|
|
|
|
|
|
|
|
rm -f sub-top.log
|
2019-01-21 17:22:21 +01:00
|
|
|
$ethload $nwif $bandwidth > $outdir/sub-ethload.log & lpid=$!
|
2019-01-17 19:14:45 +01:00
|
|
|
bin/ThroughputSubscriber 0 $mode > $outdir/sub.log & spid=$!
|
|
|
|
top -b -d1 -p $spid >> $outdir/sub-top.log & tpid=$!
|
|
|
|
tail -f $outdir/sub.log & xpid=$!
|
2019-01-21 17:22:21 +01:00
|
|
|
ssh $pubremote ". $remotedir/run-publisher.tmp"
|
2019-01-17 19:14:45 +01:00
|
|
|
kill $tpid
|
|
|
|
kill -2 $spid
|
2019-01-21 17:22:21 +01:00
|
|
|
eval $killremotesubs
|
2019-01-17 19:14:45 +01:00
|
|
|
sleep 1
|
|
|
|
kill $lpid $xpid
|
|
|
|
wait
|
2019-01-21 17:22:21 +01:00
|
|
|
scp $pubremote:$remotedir/{pub-top.log,pub.log} $outdir
|
2019-01-17 19:14:45 +01:00
|
|
|
done
|
|
|
|
done
|