Commit graph

254 commits

Author SHA1 Message Date
Erik Boasson
27bf91fae6 netmask returned by getifaddrs may not have address family set on macOS
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-18 12:13:39 +01:00
eboasson
c72964027e
Merge pull request #96 from eboasson/master
Add throughput figures to README and scripting used to generate it
2019-01-17 19:52:52 +01:00
Erik Boasson
0db99fbf4e Add some throughput figures to the README
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-17 19:49:55 +01:00
Erik Boasson
97990237bc add scripts for running a throughput test between two machines
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-17 19:49:55 +01:00
eboasson
ed5f89b143
Merge pull request #93 from eboasson/entity-rework
Performance improvements by reworking listeners/status flags (and some odds and ends)
2019-01-17 18:57:36 +01:00
Erik Boasson
98f757a5ab let dds_get_qos reset the input qos first
Getting a QoS from an entity is akin to reading, and all read/take operations reuse or free/reallocate memory to avoid memory leaks, and so it is a reasonable assumption that calling dds_get_qos repeatedly without intervening calls to dds_reset_qos would not leak any memory either. (This was actually an assumption in the builtin topics test.) Therefore, it is reasonable to first call dds_reset_qos in dds_get_qos. All operations in the API that yield or modify a QoS object result in a properly initialised one, therefore the input to dds_get_qos is necessarily initialised, and so this is safe.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-17 12:34:37 +01:00
Erik Boasson
102e657d45 minor cleanup to address some compiler warnings
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-17 10:18:14 +01:00
Erik Boasson
b864c83879 fix de-initialisation of tcp support code
Stopping and restarting the DDSI stack in a single process would not re-initialise the TCP support code properly

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-17 10:18:14 +01:00
Erik Boasson
cd02110af0 add listener-, waitset- and polling-mode to thorughput subscriber
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-17 10:18:14 +01:00
Erik Boasson
54b5bed8d2 use enum with values log2(STATUS) for identifying status/listener
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-17 10:18:14 +01:00
Erik Boasson
ba46cb1140 rework listener invocation and entity status flags
Listener/status management invocation was rather expensive, and
especially the cost of checking listeners, then setting status flags and
triggering waitsets ran into severe lock contention.

A major cost was the repeated use of dds_entity_lock and
dds_entity_unlock, these have been eliminated.  Another cost was that
each time an event occurred (with DATA_AVAILABLE the most problematic
one) it would walk the chain of ancestors to see if any had a relevant
listener, and only if none of them had any, it would set the status
flags.

The locking/unlocking of the entity has been eliminated by moving the
listener/status flag manipulation from the general entity lock to its
m_observers_lock.  That lock has a much smaller scope, and consequently
contention has been significantly reduced.

Instead of walking the entity hierarchy looking for listeners, an entity
now inherits the ancestors' listeners.  The set_listener operation has
been made a little more complicated by the need to not only set the
listeners for the specified entity, but to also update any inherited
listeners its descendants.

The commit is a bit larger than strictly needed ... I've started
reformatting the code to reduce the variety of styles ... as there I
haven't been able to find a single tool that does what I want, it may
well end up as manual work.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-17 10:18:14 +01:00
Erik Boasson
2e5ecb2e76 requiring checking the return value of dds_{get,set}_listener is pedantry
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-17 10:18:14 +01:00
Erik Boasson
14a80978f3 enable tons of warnings in Xcode
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-17 10:18:14 +01:00
Erik Boasson
0057896beb skip testing lookup of an invalid hostname, it times out in some configurations
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-17 10:18:14 +01:00
Erik Boasson
e4360d25a0 code cleanup: replacement of lots of function-like macros by inline functions, removal of unnecessary casts
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-17 10:18:14 +01:00
eboasson
cf7eab5298
Merge pull request #94 from eboasson/master
fix read of uninitialized program name in dds_init
2019-01-15 15:08:21 +01:00
Erik Boasson
336a9da8b4 fix read of uninitialized program name in dds_init
dds_init generates an entity name for the participant derived from the
process name and process id, but the name is currently uninitialised
(temporarily so, caused by a recent update to the OS abstraction layer).

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-15 15:07:40 +01:00
eboasson
c10a7fab4a
Merge pull request #89 from eboasson/builtintopics
Builtintopics Revisited
2019-01-15 11:46:48 +01:00
eboasson
f863975504
Merge pull request #92 from eboasson/issue-83
Avoid delivery of history to volatile reader
2019-01-15 10:39:53 +01:00
Erik Boasson
8ab1cd8987 remove bogus mutex_init_stress test
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-14 11:45:31 +01:00
Erik Boasson
72c1920eed Avoid delivery of history to volatile reader
When a remote writer is discovery, a proxy_writer object representation
that writer is created without yet having any knowledge of what the
current sequence number for that writer is.  If a local reader is
matched with that proxy writer before a Heartbeat has been recevied and
this sequence number information is known, all historical data will be
made available to that reader, even if it is volatile.

By treating the first Heartbeat specially, by moving the next sequence
number to be delivered as fresh data forward to the next sequence
number, retrieval of historical data is avoided.  Transient-local
readers have a separate ("out-of-sync") route to request it anyway.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-11 13:12:15 +01:00
Erik Boasson
d659b416f2 undo breakage of OpenIndiana (Solaris) build
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-09 11:15:11 +01:00
Erik Boasson
de3d3cc8cd fix formatting error for durations in ddsls
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-09 08:38:56 +01:00
Erik Boasson
66076817e1 rework built-in topics again
Move details of built-in topics out of the DDSI core (so the only hooks
remain).  For this, rtps_term had to be split, so now it is "stop"
followed by "fini".

Add a notion of local writers that are not bound to a participant ("local
orphans"), so that the local built-in topic writers can be created during
initialization.  This eliminates the "builtin" participant.  This
uncovered in inconsistency in the unit tests: on the one hand, a newly
created participant is expected to have no child entities; on the other
hand, the built-in topics were expected to be returned by find_topic ...
This inconsistency has been resolved by creating them lazily and
accepting that find_topic can't return them until they have been
created.  Special code was in place in dds_create_reader anyway, so it
is not expected to have any real consequence for applications.

Use a special WHC implementation that regenerates the data on the fly
using the internal discovery tables of DDSI, so that the samples are only
stored by readers.  This eliminates the memory overhead of that existed
previously when the WHC of the writers stored the data.

No longer return topic name and type name in the built-in topics, they
have been extracted already and are not accessible through the normal
interface but do cause problems when comparing QoS.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-09 08:38:56 +01:00
Erik Boasson
d6dcb0558d fix incorrect QoS compare that breaks creating topics multiple times
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-09 08:38:37 +01:00
Erik Boasson
30f421ea9b remove a stray debugging printf when calling create_topic multiple times for the same topic
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-09 08:38:37 +01:00
Erik Boasson
24802ecad3 avoid setting topic and type name in the QoS objects returned in the built-in topics
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-09 08:38:37 +01:00
eboasson
e518f9d0e2
Merge pull request #80 from k0ekk0ek/gethostbyname
Cleanups of abstraction, layer, cmake, windows warnings and addition of os_gethostbyname
2019-01-09 08:22:23 +01:00
Jeroen Koekkoek
62b9b8d9dc Replace OS_INLINE by inline
Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
2019-01-08 16:40:07 +01:00
Jeroen Koekkoek
c86bda7aa4 Move operating system abstractions from DDSI to abstraction layer
Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
2019-01-08 16:40:07 +01:00
Jeroen Koekkoek
9475024a5f Replace NN_C99_INLINE and VDDS_INLINE by OS_INLINE
Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
2019-01-08 16:40:07 +01:00
Jeroen Koekkoek
934ff535d6 Cleanup socket functions a bit
Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
2019-01-08 16:40:07 +01:00
Jeroen Koekkoek
0bc263e537 Remove unnecessary os_procName and os_procNamePid functions
Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
2019-01-08 16:40:07 +01:00
Jeroen Koekkoek
a2aab8eab2 Remove dead code
Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
2019-01-08 16:40:07 +01:00
Jeroen Koekkoek
3c0b86df9c Add os_gethostbyname and tidy socket address to and from text form functions
Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
2019-01-08 16:40:07 +01:00
Jeroen Koekkoek
5835a85dc2 Remove unused types and definitions from abstraction layer
Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
2019-01-07 18:15:07 +01:00
Jeroen Koekkoek
e25656a4c5 Remove unnecessary CMake modules and fixup os/CMakeLists.txt
Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
2019-01-07 18:15:07 +01:00
eboasson
1990007614
Merge pull request #84 from eboasson/odds-and-ends
Odds and ends
2019-01-07 16:39:52 +01:00
Erik Boasson
198e1bfc84 fix Solaris relocation issue by adding -KPIC flag for utilities library (when using SunPro)
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-04 16:55:38 +01:00
Erik Boasson
d920b51b05 fix uninitialised value propagating into key of topic discovery data used by WHC
The only consequence is that the tkmap would probably map the same topic to a different iid each time one was written, or that a different topic would get mapped to some other iid. The latter would cause the WHC to overwrite the older topic. Actual damage is minimal as it would only result in incomplete topic discovery by OpenSplice. That it is mostly harmless today does not mean it couldn't cause any number of interesting surprises in the future.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-04 16:22:35 +01:00
Erik Boasson
f2d0dd2ef4 fix use of initialized memory (in this case, harmless) when a undersized packet is received
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-04 16:22:35 +01:00
Erik Boasson
771eed118b concurrent hopscotch hashtable only needs a load-load barrier in lookup
and that is implied by the x86/x64's memory model ... avoiding the mfence instruction is a significant win

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-04 10:49:25 +01:00
Erik Boasson
95f070d097 cleanup_defrag need not inspect any readers when all readers are in sync
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-04 10:49:21 +01:00
Erik Boasson
4cc7fac8bc clean up tracing for SPDP messages in when discovery category is enabled, but not full tracing
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-04 10:49:21 +01:00
Erik Boasson
c60f4fb797 be consistent in generating the hash for the key value for keyless topics
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-04 10:49:21 +01:00
Erik Boasson
d51a67f74b use plain os_malloc in RHC for performance reasons
simply switching from dds_alloc to os_malloc in alloc_sample removes a redundant memset, which gives 5% improvement in a throughput test (on my laptop); other analogous changes for consistency

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-04 10:48:57 +01:00
Erik Boasson
c61c880fd2 make proxy reader/writer references to sertopics properly counted, strong references
without this, deleting the last reader/writer that references the topic results in a dangling pointer ... but there is another intriguing solution: erase the topic from the proxy reader/writer when the last matching local one disappears, so that the topic completely disappears. I rather like this second solution, but I am not yet sure of the consequences and the first (implemented one) is such a simple change that fixes a real problem that it is a no-brainer

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-03 17:30:25 +01:00
Erik Boasson
0d0a2bd2df increase maximum size of thread name in tracing code to fit "dq.builtin"
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-02 16:44:24 +01:00
Erik Boasson
52a0751055 fix leaking of address sets in network partitions
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-02 16:43:42 +01:00
Erik Boasson
23972aa8f7 change the way WHC state is passed round in the transmit path to allow tighter assertions and silencing of warnings from clang's static analyzer
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-02 15:03:21 +01:00