Reorganize repository

* Move the project top-level CMakeLists.txt to the root of the project;
  this allows building Cyclone as part of ROS2 without any special
  tricks;

* Clean up the build options:

  ENABLE_SSL:    whether to check for and include OpenSSL support if a
                 library can be found (default = ON); this used to be
                 called DDSC_ENABLE_OPENSSL, the old name is deprecated
                 but still works
  BUILD_DOCS:    whether to build docs (default = OFF)
  BUILD_TESTING: whether to build test (default = OFF)

* Collect all documentation into top-level "docs" directory;

* Move the examples to the top-level directory;

* Remove the unused and somewhat misleading pseudo-default
  cyclonedds.xml;

* Remove unused cmake files

Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
Erik Boasson 2019-07-26 09:43:53 +02:00 committed by eboasson
parent 4e80559763
commit 9cf4b97f1a
102 changed files with 627 additions and 1925 deletions

48
examples/perfscript/ethload Executable file
View file

@ -0,0 +1,48 @@
#!/usr/bin/perl -w
use strict;
use bignum;
use Time::HiRes qw (time);
if (@ARGV != 2) {
print STDERR "usage: $0 device {100|1000}\n";
exit 1;
}
my $devname = $ARGV[0];
my $speed = $ARGV[1] * 1e6;
$| = 1;
my ($lt, $t, $lrecv, $lxmit);
while (1) {
open FH, "< /proc/net/dev" or die "can't open /proc/net/dev";
$t = time;
my $info = undef;
while (<FH>) {
chomp;
if (s/^\s+$devname\s*:\s*//) {
$info = $_;
last;
}
}
close FH;
die "can't locate info for $devname" unless defined $info;
my @info = split ' ', $info;
my $recv = $info[0] + 0;
my $xmit = $info[8] + 0;
if (defined $lt) {
my $dr = $recv - $lrecv;
my $dx = $xmit - $lxmit;
my $dt = $t - $lt;
my $ur = 100 * (8 * $dr) / ($dt * $speed);
my $xr = 100 * (8 * $dx) / ($dt * $speed);
printf "r %5.1f x %5.1f (%8d %8d)\n", $ur, $xr, $dr, $dx;
}
$lt = $t;
$lrecv = $recv;
$lxmit = $xmit;
sleep 1;
}

View file

@ -0,0 +1,30 @@
export CYCLONEDDS_URI='<Internal><MinimumSocketReceiveBufferSize>250kB</></><General><MaxMessageSize>65500B</><FragmentSize>65000B</>'
set -x
gen/ddsperf -D20 -L ping pon
for x in 16 32 64 128 1024 4096 16384 ; do
gen/ddsperf -D20 -TKS -z$x -L ping pong
done
gen/ddsperf -D20 -L pub sub
for x in 16 32 64 128 1024 4096 16384 ; do
gen/ddsperf -D20 -TKS -z$x -L pub sub
done
gen/ddsperf pong & pid=$!
gen/ddsperf -D20 ping
kill $pid
wait
gen/ddsperf -TKS pong & pid=$!
for x in 16 32 64 128 1024 4096 16384 ; do
gen/ddsperf -D20 -TKS -z$x ping
done
kill $pid
wait
gen/ddsperf sub & pid=$!
gen/ddsperf -D20 pub
kill $pid
wait
gen/ddsperf -TKS sub & pid=$!
for x in 16 32 64 128 1024 4096 16384 ; do
gen/ddsperf -D20 -TKS -z$x pub
done
kill $pid
wait

View file

@ -0,0 +1,73 @@
#!/bin/bash
usage () {
cat >&2 <<EOF
usage: $0 [OPTIONS] user@remote [user@remote...]
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 multicast loopback (true/false, default: true)
-o DIR store results in dir.N where N is number of nodes
Runs throughput-test with the specified options for each prefix of remote nodes.
EOF
exit 1
}
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
pubremote=$1
shift
popt=
$provision && popt=-p
n=0
while [[ $n -le $# ]] ; do
out=$resultdir.$(( $n + 1 ))
mkdir $out
otherhosts=""
j=1
while [[ $j -le $n ]] ; do
hostJ=`eval echo "\\$$j"`
otherhosts="$otherhosts $hostJ"
j=$(( $j + 1 ))
done
`dirname $0`/throughput-test -i "$nwif" -b "$bandwidth" -d "$remotedir" $popt -a "$asynclist" -m "$modelist" -s "$sizelist" -t "$timeout" -o $out $pubremote $otherhosts
n=$(( $n + 1 ))
done

View file

@ -0,0 +1,159 @@
#!/bin/bash
usage () {
cat >&2 <<EOF
usage: $0 [OPTIONS] user@remote [user@remote...]
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.
EOF
exit 1
}
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
cfg=cdds-simple.xml
cat >$cfg <<EOF
<CycloneDDS>
<Domain>
<Id>17</Id>
</Domain>
<DDSI2E>
<General>
<NetworkInterfaceAddress>$nwif</NetworkInterfaceAddress>
<EnableMulticastLoopback>$loopback</EnableMulticastLoopback>
</General>
<Internal>
<Watermarks>
<WhcHigh>500kB</WhcHigh>
</Watermarks>
<SynchronousDeliveryPriorityThreshold>${async:-0}</SynchronousDeliveryPriorityThreshold>
<LeaseDuration>3s</LeaseDuration>
</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
[ -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 <<EOF
export CYCLONEDDS_URI=file://$remotedir/$cfg
export async=$async
cd $remotedir
rm -f pub-top.log
for size in $sizelist ; do
echo "size \$size"
bin/ThroughputPublisher \$size > 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 <<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
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

View file

@ -0,0 +1,59 @@
#!/usr/bin/perl -w
use strict;
my @dirs = ("async0-mode-1", "async0-mode0", "async0-mode1",
"async1-mode-1", "async1-mode0", "async1-mode1");
my $dataset = 0;
my $basedir = "throughput-result";
$basedir = $ARGV[0] if @ARGV== 1;
my $load_threshold = 20;
for my $dir (@dirs) {
my @loads = ();
{
open LH, "< $basedir/data-$dir/sub-ethload.log" or next; # die "can't open $basedir/data-$dir/sub-ethload.log";
my @curload = ();
while (<LH>) {
next unless /^r +([0-9.]+).*\( *(\d+)/;
push @curload, $2 if $1 > $load_threshold;
if (@curload && $1 < $load_threshold) {
push @loads, median (@curload);
@curload = ();
}
}
push @loads, median (@curload) if @curload;
close LH;
}
open FH, "< $basedir/data-$dir/sub.log" or next; # die "can't open $basedir/data-$dir/sub.log";
print "\n\n" if $dataset++;
print "# mode $dir\n";
print "# payloadsize rate[samples/s] appl.bandwidth[Mb/s] raw.bandwidth[Mb/s]\n";
my $psz;
my @rate = ();
while (<FH>) {
next unless /Payload size: ([0-9]+).*Transfer rate: ([0-9.]+)/;
my $psz_cur = $1; my $rate_cur = $2;
$psz = $psz_cur unless defined $psz;
if ($psz != $psz_cur) {
my $load = shift @loads;
my $rate = median (@rate);
printf "%d %f %f %f\n", $psz, $rate, $rate * (8 + $psz) / 125e3, $load / 125e3;
@rate = ();
}
$psz = $psz_cur;
push @rate, ($rate_cur + 0.0);
}
my $load = shift @loads;
my $rate = median (@rate);
printf "%d %f %f %f\n", $psz, $rate, $rate * (8 + $psz) / 125e3, $load / 125e3;
close FH;
}
sub median {
my @xs = sort { $a <=> $b } @_;
return (@xs % 2) ? $xs[(@xs - 1) / 2] : ($xs[@xs/2 - 1] + $xs[@xs/2]) / 2;
}

View file

@ -0,0 +1,14 @@
#!/bin/bash
`dirname $0`/throughput-test-extract > data.txt
gnuplot <<\EOF
set term png size 1024,768
set output "throughput-polling.png"
set st d l
set title "Throughput (polling with 1ms sleeps)"
set ylabel "M sample/s"
set y2label "Mbps"
set y2tics
set xlabel "payload size [bytes]"
p "data.txt" i 5 u 1:($2/1e6) ti "rate [M sample/s]", "" i 5 u 1:3 axes x1y2 ti "app bandwidth [Mbps]", "" i 5 u 1:4 axes x1y2 ti "GbE bandwidth [Mbps]"
EOF