#!/bin/bash export nwif=eth0 bandwidth=1e9 remotedir="$PWD" provision=false asynclist="sync async" modelist="listener polling waitset" sizelist="0 20 50 100 200 500 1000 2000 5000 10000 20000 50000 100000 200000 500000 1000000" timeout=30 loopback=true resultdir="throughput-result" usage () { cat >&2 <$cfg < 17 $nwif $loopback 65500B 4000B 500kB \${async:-0} 3s config EOF if [ ! -x bin/ddsperf ] ; then echo "bin/ddsperf not found on the local machine" >&2 exit 1 fi [ -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/ddsperf $r:$remotedir/bin done fi topic=KS [ -z "$sizelist" ] && topic=OU export CYCLONEDDS_URI=file://$PWD/$cfg for r in $pubremote "$@" ; do scp $cfg $r:$remotedir || { echo "failed to copy $cfg to $remote:$PWD" >&2 ; exit 1 ; } done for async_mode in $asynclist ; do case "$async_mode" in sync) async=0 ;; async) async=1 ;; *) echo "$async_mode: invalid setting for ASYNC" >&2 ; continue ;; esac export async for sub_mode in $modelist ; do echo "======== ASYNC $async MODE $sub_mode =========" cat > run-publisher.tmp < pub.log sleep 5 done wait EOF 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 < /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/$async_mode-$sub_mode mkdir $outdir bin/ddsperf -d $nwif:$bandwidth -c -T $topic sub $sub_mode > $outdir/sub.log & spid=$! tail -f $outdir/sub.log & xpid=$! ssh $pubremote ". $remotedir/run-publisher.tmp" kill $spid eval $killremotesubs sleep 1 kill $xpid wait scp $pubremote:$remotedir/pub.log $outdir done done