Commit graph

31 commits

Author SHA1 Message Date
Erik Boasson
dff08536c4 Quick-n-dirty statistics framework
This adds a set of functions:

* dds_create_statistics
* dds_refresh_statistics
* dds_delete_statistics
* dds_lookup_statistic

to poll entities for information on their state, returned as a set of
name-value pairs.  The interface and selection of statistics (and
naming) is all provisional, and for this reason the
dds/ddsc/dds_statistisc.h file is not included by dds.h.

Currently, the only statistics available relate to retansmits and are
optionally output by ddsperf.

Signed-off-by: Erik Boasson <eb@ilities.com>
2020-07-06 11:40:56 +02:00
Erik Boasson
b116e6e41e ddsperf and throughput-test script improvements
* Bandwidth usage is now printed in Mb/s if no reference rate is given

* Trailing average rate over the last 10s (approximated as the last 10
  lines of output) is printed

* An option to wait until the expected number of peers is present

* The test script now pushes data to the remotes, instead of using the
  first remote as the publisher

Signed-off-by: Erik Boasson <eb@ilities.com>
2020-07-06 11:40:56 +02:00
Erik Boasson
66daba9f2f Adapt message and burst sizes to receive buffers
This changes a few intertwined things at the same time:

* It allows configuring sending a partial message for large messages,
with a maximum derived from the discovered receive buffer sizes;

* It uses a different message size limit for datagrams that include
  retransmits than for those that don't.  The argument here is that,
  having seen flaky networks where large datagrams cause trouble, it
  makes sense to default to sending retransmits as datagrams that fit in
  individual packets.

* The best performance is generally obtained using the maximum data gram
  size, but the benefits do fall off quite quickly once they are
  largish.  For flaky networks, it doesn't make sense to go for 64kB
  datagrams.  This tries to find a reasonable compromise.

* It now packs mutiple fragments into a single DATAFRAG message to
  eliminate the cost of using small fragment sizes.

The changes in buffer sizes cause the ddsperf sanity check to fail:

* The larger amounts of unacknowledged data cause the used memory to be
  higher, failing the RSS check.  Raising the limit seems
  reasonable (the alternative would be to configure it back to the old
  values, but it is all empirically determined anyway).

* The same also causes the publisher thread to get to run more and the
  ping/pong bit gets less of a chance.  Using fixed-frequency bursts
  helps with this.

This therefore also adjust the test configuration and the thresholds a
bit.

Signed-off-by: Erik Boasson <eb@ilities.com>
2020-07-06 11:40:56 +02:00
Erik Boasson
f08b4e0c5d Remove some dead stores signalled by clang analyzer
Signed-off-by: Erik Boasson <eb@ilities.com>
2020-06-08 15:31:32 +02:00
Erik Boasson
b2cf6921da Define dds_guid_t as dds_builtintopic_guid_t
The former name should be less confusing.  Backwards compatibility is
preserved by only adding the sensible name as a typedef.

Signed-off-by: Erik Boasson <eb@ilities.com>
2020-04-09 17:02:11 +02:00
Erik Boasson
6413d71599 Workaround for false positive from clang-tidy (#452)
Signed-off-by: Erik Boasson <eb@ilities.com>
2020-03-27 15:28:00 +01:00
Erik Boasson
0b9ab17018 Do not set DCPSParticipant listener too early
The participant listener creates a pong writer, setting a publication
matched listener on it.  That listener can be invoked immediately and as
it queries the subscriptions reader, it must not be enabled before the
latter reader has been created.

Signed-off-by: Erik Boasson <eb@ilities.com>
2020-03-18 17:31:20 +01:00
Erik Boasson
9a0ad5e2f5 ddsperf argument checking improvements
Inspired by Coverity warnings.

Signed-off-by: Erik Boasson <eb@ilities.com>
2020-02-18 13:55:44 +01:00
Thijs Sassen
2cd8909beb Fixed build error on FreeRTOS
Signed-off-by: Thijs Sassen <thijs.sassen@adlinktech.com>
2020-02-13 10:59:33 +01:00
Erik Boasson
8d6b308199 Add more checks to ddsperf and run on Travis
This adds options to check for "unreasonable" RSS growth, receipt of a
minimum number of samples and having run a minimum number of roundtrips.

Signed-off-by: Erik Boasson <eb@ilities.com>
2020-02-12 17:19:48 +01:00
Erik Boasson
b84eee5abb Fix detecting remote ping/pong writers in ddsperf
The status mask on some readers got reduced to just "data available"
when used in conjunction with a waitset, but the consequence is that the
"subscription matched" listener would be suppressed.

Signed-off-by: Erik Boasson <eb@ilities.com>
2020-02-11 23:26:01 +01:00
Bart Poot
9a3a377327 Fixed coverity issues
Signed-off-by: Bart Poot <bart.poot@adlinktech.com>

Processed review comments

Signed-off-by: Bart Poot <bart.poot@adlinktech.com>
2019-11-25 18:26:15 +01:00
Erik Boasson
2d8bf36f8e Fix ddsperf interpretation of kHz
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-11-18 14:20:55 +01:00
Erik Boasson
210fa7e78f Add keyless topics with small payloads to ddsperf
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-11-18 14:20:55 +01:00
Erik Boasson
891fc2b12f Support multiple domains in configuration
Change the structure of the configuration file (in a backwards
compatible manner) to allow specifying configurations for multiple
domains in a file.  (Listing multiple files in CYCLONEDDS_URI was
already supported.)  A configuration specifies an id, with a default of
any, configurations for an incompatible id are ignored.

If the application specifies an id other than DDS_DOMAIN_DEFAULT in the
call to create_participant, then only configuration specifications for
Domain elements with that id or with id "any" will be used.  If the
application does specify DDS_DOMAIN_DEFAULT, then the id will be taken
from the first Domain element that specifies an id.  If none do, the
domain id defaults to 0.  Each applicable domain specification is taken
as a separate source and may override settings made previously.

All settings moved from the top-level CycloneDDS element to the
CycloneDDS/Domain element.  The CycloneDDS/Domain/Id element moved to
become the "id" attribute of CycloneDDS/Domain.  The old locations still
work, with appropriate deprecation warnings.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-08-21 14:16:51 +02:00
Erik Boasson
40ba6b207f Small ddsperf enhancements
* Change default behaviour with no arguments to print help text;
  "ddsperf sanity" now gives the behaviour that it used to give when run
  with no arguments;

* Include context switch rate in output;

* Allow suffixing frequencies and sizes with standard units (so "size
  1kB" is now allowed);

* Add missing option to help text, extend help text with some additional
  informationr.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-08-06 08:32:14 +02:00
Thijs Sassen
c0b0db3ae2 Fixed not building freertos target due to conflict in print definition
Signed-off-by: Thijs Sassen <thijs.sassen@adlinktech.com>
2019-08-05 13:56:53 +02:00
Erik Boasson
952029dba0 ddsperf enhancements
* per-thread CPU usage (only those threads where the load is over 0.5%,
  if the sum of threads below that threshold exceeds 0.5%, it prints an
  aggregate for those threads);

* also report RSS;

* network load (only on request, as percentage of specified network
  bandwidth and actual bytes in/out, with the output suppressed if it is
  0%);

* publish CPU usage so a ddsperf instance can display CPU loads for
  its peers;

* handle SIGXFSZ (file size exceeded) by displaying one last line of
  statistics before killing itself; this simply a debugging tool to make
  it easier to get a trace covering a high sample-rate start-up issue;

* default topic changed to "KS" because that allows all the options to
  be used, this has a negative impact on performance (both latency and
  small-sample throughput) but it should be less surprising to users;

* specifying a size is now done by appending "size N" (where N is the
  size in bytes) after a "ping" or "pub" command, rather than it having
  to set it via a command-line option;

Note that some of this is platform-dependent -- SIGXFSZ is currently
only on Linux and macOS, and CPU and network load reporting is currently
only on Linux, macOS and Windows.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-08-02 09:53:36 +02:00
Erik Boasson
9cf4b97f1a 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>
2019-07-30 10:52:44 +02:00
Erik Boasson
fda285e2f5 Add support for Solaris 2.6 on sun4m builds
It is an excellent platform for catching bugs: big-endian, slow enough
that a context switch in the middle of an operation becomes a regular
occurrence, and all that on a SMP box.  Or: I just wanted to see if it
would work.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-07-25 10:59:09 +02:00
Erik Boasson
12d2a82823 Remove superfluous lock/unlock pairs in read
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-06-28 12:47:27 +02:00
Erik Boasson
6ad99463ce Fix ddsperf race conditions
Tracking pings and expected number of pongs was done without holding the
correct locks.  Terminate flag was also not a ddsrt_atomic... and hence
flagged by thread sanitizer as a race condition.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-06-28 12:47:27 +02:00
Erik Boasson
19aec98b8a Clean up return code types
* Remove dds_return_t / dds_retcode_t distinction (now there is only
  dds_return_t and all error codes are always negative)

* Remove Q_ERR_... error codes and replace them by DDS_RETCODE_...
  ones so that there is only one set of error codes

* Replace a whole bunch "int" return types that were used to return
  Q_ERR_... codes by "dds_return_t" return types

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-06-10 10:42:52 +02:00
Erik Boasson
c2cf340a1b various ddsperf fixes
* As a simple matter of code hygiene, in particular to aid in checking for
  leaks, ddsperf should free all memory it allocates on exit.

* Remove spurious mutex unlock in ddsperf

* Removing a participant means removing one or two entries from the "pong
  writers" array ("pong wr"), and there it read 1 element beyond the end
  of the array while moving the remaining elements forward.

* Constant-rate pinging was broken because of two reasons, one worse than
  the other:

  * setting the rate had a mismatch in variables (publication rate and
    command-line argument) resulting in a completely wrong ping interval;
    the code now has a bit more clear variable naming ...

  * the timing of the pings was relative to the current time, but the
    wakeup a little delayed, resulting in a lower rate than requested.
    It now simply adds the ping interval to the scheduled ping time, rather
    than the time at which the ping is being sent.  To guard against really
    late wakeups, rates that are too high, suspending the machine, &c. it
    will in extremis delay the next ping.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-05-24 07:48:45 +02:00
Jeroen Koekkoek
aa2715f4fe Add support for FreeRTOS and lwIP (#166)
Add support for FreeRTOS and lwIP

Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
2019-05-23 14:27:56 +02:00
Erik Boasson
a7c7ac54c3 make ddsperf polling/waitset mode selectable again
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-05-02 20:53:20 +08:00
Erik Boasson
d700657cb7 ddsperf latnecy should include median, 90% and 99%
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-05-02 20:53:20 +08:00
Erik Boasson
6011422566 ddsperf: fix calculation of data rate in Mb/s
Multiplying time-in-ns since previous output line by 1e9 instead of
dividing it by 1e9 resulted in bit rate showing up as 0Mb/s.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-05-02 20:53:20 +08:00
Jeroen Koekkoek
c9d827e420 Fix warnings related to fixed type integers
Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
2019-04-29 19:22:11 +02:00
Erik Boasson
d2ebbbc880 address a handful of compiler warnings in ddsperf
These are fortunately all false positives.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-04-29 11:15:41 +02:00
Erik Boasson
06245d0d4a initial version of permance/network check tool
The current situation for performance measurements and checking network
behaviour is rather unsatisfactory, as the only tools available are
``pubsub`` and the ``roundtrip`` and ``throughput`` examples.  The first
can do many things thanks to its thousand-and-one options, but its
purpose really is to be able to read/write arbitrary data with arbitrary
QoS -- though the arbitrary data bit was lost in the hacked conversion
from the original code.  The latter two have a terrible user interface,
don't perform any verification that the measurement was successful and
do not provide the results in a convenient form.

Furthermore, the abuse of the two examples as the primary means for
measuring performance has resulted in a reduction of their value as an
example, e.g., they can do waitset- or listener-based reading (and the
throughput one also polling-based), but that kind of complication does
not help a new user understand what is going on.  Especially not given
that these features were simply hacked in.

Hence the need for a new tool, one that integrates the common
measurements and can be used to verify that the results make sense.  It
is not quite done yet, in particular it is lacking in a number of
aspects:

* no measurement of CPU- and network load, memory usage and context
  switches yet;
* very limited statistics (min/max/average, if you're lucky; no
  interesting things such as jitter on a throughput test yet);
* it can't yet gather the data from all participants in the network
  using DDS;
* it doesn't output the data in a convenient file format yet;
* it doesn't allow specifying boundaries within which the results
  must fall for the run to be successful.

What it does verify is that all the endpoint matches that should exist
given the discovered participant do in fact come into existence,
reporting an error (and exiting with an exit status code of 1) if they
don't, as well as checking the number of participants.  With the way the
DDSI protocol works, this is a pretty decent network connectivity check.

The raw measurements needed for the desired statistics (apart from
system-level measurements) are pretty much made, so the main thing that
still needs to be done is exploit them and output them.  It can already
replace the examples for most benchmarks (only the 50%/90%/99%
percentiles are still missing for a complete replacement).

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-04-24 14:09:30 +02:00