#!/bin/bash usage () { cat >&2 <$cfg < 17 $nwif $loopback 500kB ${async:-0} 3s 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 [ -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 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 in $asynclist ; do export async for mode in $modelist ; do echo "======== ASYNC $async MODE $mode =========" cat > run-publisher.tmp < pub.log & ppid=\$! top -b -d1 -p \$ppid >> pub-top.log & tpid=\$! sleep $timeout kill \$tpid kill -2 \$ppid wait \$ppid 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/data-async$async-mode$mode mkdir $outdir rm -f sub-top.log $ethload $nwif $bandwidth > $outdir/sub-ethload.log & lpid=$! bin/ThroughputSubscriber 0 $mode > $outdir/sub.log & spid=$! top -b -d1 -p $spid >> $outdir/sub-top.log & tpid=$! tail -f $outdir/sub.log & xpid=$! ssh $pubremote ". $remotedir/run-publisher.tmp" kill $tpid kill -2 $spid eval $killremotesubs sleep 1 kill $lpid $xpid wait scp $pubremote:$remotedir/{pub-top.log,pub.log} $outdir done done