90 lines
2.4 KiB
Bash
90 lines
2.4 KiB
Bash
#!/bin/bash
|
|
|
|
if [ $# -ne 1 ] ; then
|
|
echo >&2 <<EOF
|
|
usage: $0 user@remote
|
|
|
|
It assumes various things:
|
|
- ssh user@remote succeeds without a password
|
|
- network device to use is em2 (otherwise, change the config)
|
|
- it assumes it is run from the build directory (actually, it verifies this)
|
|
- it assumes ThroughputPublisher can be found in exactly the same place on the remote
|
|
- probably some other things as well ... use with care.
|
|
EOF
|
|
exit 1
|
|
fi
|
|
remote=$1
|
|
dir=`dirname $0`
|
|
ethload=$dir/ethload
|
|
|
|
cfg=cdds-simple.xml
|
|
cat >$cfg <<EOF
|
|
<CycloneDDS>
|
|
<Domain>
|
|
<Id>17</Id>
|
|
</Domain>
|
|
<DDSI2E>
|
|
<General>
|
|
<NetworkInterfaceAddress>em2</NetworkInterfaceAddress>
|
|
</General>
|
|
<Internal>
|
|
<Watermarks>
|
|
<WhcHigh>500kB</WhcHigh>
|
|
</Watermarks>
|
|
<SynchronousDeliveryPriorityThreshold>${ASYNC:-0}</SynchronousDeliveryPriorityThreshold>
|
|
</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
|
|
|
|
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 <<EOF
|
|
export CYCLONEDDS_URI=$CYCLONEDDS_URI
|
|
export ASYNC=$async
|
|
cd $PWD
|
|
rm -f pub-top.log
|
|
for size in 0 16 32 64 128 256 ; do
|
|
echo "size \$size"
|
|
bin/ThroughputPublisher \$size > 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
|