#!/bin/bash if [ $# -ne 1 ] ; then echo >&2 <$cfg < 17 em2 500kB ${ASYNC:-0} 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 mkdir throughput-result || { echo "failed to create throughput-result directory" >&2 ; exit 1 ; } export CYCLONEDDS_URI=file://$PWD/$cfg scp $cfg $remote:$PWD || { echo "failed to copy $cfg to $remote:$PWD" >&2 ; exit 1 ; } for async in 0 1 ; do for mode in -1 0 1 ; do echo "======== ASYNC $async MODE $mode =========" cat > run-publisher.tmp < pub.log & ppid=\$! top -b -d1 -p \$ppid >> pub-top.log & tpid=\$! sleep 20 kill \$tpid kill -2 \$ppid wait \$ppid sleep 5 done wait EOF scp run-publisher.tmp $remote:$PWD || { echo "failed to copy $cfg to $remote:$PWD" >&2 ; exit 2 ; } export ASYNC=$async outdir=throughput-result/data-async$async-mode$mode mkdir $outdir rm -f sub-top.log $ethload em2 1000 > $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 $remote ". $PWD/run-publisher.tmp" kill $tpid kill -2 $spid sleep 1 kill $lpid $xpid wait scp $remote:$PWD/{pub-top.log,pub.log} $outdir done done