Commit graph

75 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
ed06ab8f4b trivial modifications to pacify gcc -O2 and clang --analyze
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-02 15:03:20 +01:00
Erik Boasson
65ac9b0711 fix error propagation in dds_get_qos
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-02 15:03:18 +01:00
Erik Boasson
179a35d192 fix race conditions in instance id-to-key lookup
this is just an intermediate step: firstly, iid-to-key lookup is a linear scan; secondly, the lookup should happen on the RHC or the WHC and not on some internal map to associates key values with instance handles and is independent of entities

Signed-off-by: Erik Boasson <eb@ilities.com>
2018-12-25 12:40:05 +01:00
Erik Boasson
0f7ce1ac43 instance operations must also ensure thread is considered awake or GC may free tkmap instances prematurely
Signed-off-by: Erik Boasson <eb@ilities.com>
2018-12-25 12:40:05 +01:00
Erik Boasson
84506b8518 rollback changes to dispose counts when resource limits reached during RHC update
Signed-off-by: Erik Boasson <eb@ilities.com>
2018-12-25 12:40:05 +01:00
Erik Boasson
e96a47f3f9 fix test issues detected by address sanitizer
Signed-off-by: Erik Boasson <eb@ilities.com>
2018-12-25 12:40:05 +01:00
Erik Boasson
98c53db057 fix leak of config data if a domain id problem leads to an initialization failure
Signed-off-by: Erik Boasson <eb@ilities.com>
2018-12-25 12:40:05 +01:00
eboasson
97c5e06b6a
Merge pull request #69 from FirasSahliADLinktech/rename-functions
Make function names more consistent:

* ``dds_topic_{get,set}_filter`` -> ``dds_{get,set}_topic_filter``
* ``dds_{get,set}_enabled_status`` -> ``dds_{get,set}_status_mask``
* ``dds_instance_lookup`` -> ``dds_lookup_instance``

Plus removal of defunct ddsv2.h.
2018-12-25 12:38:25 +01:00
Erik Boasson
1a0fcea0c2 replace old builtin topics by new ones and add implementation of DCPSSubscription and DCPSPublication
Signed-off-by: Erik Boasson <eb@ilities.com>
2018-12-14 14:02:08 +01:00
Erik Boasson
78d49b52a0 add new "builtin topic" types and conversion routines
Signed-off-by: Erik Boasson <eb@ilities.com>
2018-12-14 14:02:08 +01:00
Erik Boasson
945fc94de7 setting "must inspect result" on return_loan is pedantry
Signed-off-by: Erik Boasson <eb@ilities.com>
2018-12-14 14:02:08 +01:00
Erik Boasson
e631567c35 extend sertopic interface and move the concept of a type descriptor to just the sertopic definition
Signed-off-by: Erik Boasson <eb@ilities.com>
2018-12-14 14:02:08 +01:00
Erik Boasson
29f542b916 iid and tkmap are integral to this DDSI stack and should be part of it
They were made available from the DCPS layer to DDSI using some function pointers, but it makes more sense to have them as part of the DDSI core.

Signed-off-by: Erik Boasson <eb@ilities.com>
2018-12-14 14:02:08 +01:00
Firas Sahli
9f51f6f9dc
Rename get and set filter functions for topic
Signed-off-by: Firas Sahli <firas.sahli@adlinktech.com>
2018-12-11 11:07:09 +01:00
Firas Sahli
05f961dec1
Rename get and set of enabled status to mask
Signed-off-by: Firas Sahli <firas.sahli@adlinktech.com>
2018-12-11 11:07:09 +01:00
Firas Sahli
99f410bc49
Rename dds_instance_lookup to dds_lookup_instance
Signed-off-by: Firas Sahli <firas.sahli@adlinktech.com>
2018-12-11 11:06:50 +01:00
Firas Sahli
af7e34f143
Remove ddsv2.h
Signed-off-by: Firas Sahli <firas.sahli@adlinktech.com>
2018-12-11 11:06:27 +01:00
Jeroen Koekkoek
3c5a209389 Fix build warnings by passing a message to CU_PASS
Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
2018-12-10 13:05:59 +01:00
Jeroen Koekkoek
74a48c5731 Replace Criterion by CUnit
Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
2018-12-06 14:48:30 +01:00
Erik Boasson
e62abe623a fix warnings on qos function names and constness
Signed-off-by: Erik Boasson <eb@ilities.com>
2018-12-01 10:01:13 +01:00
Jeroen Koekkoek
1cf03332ca Simplify logging and remove unwanted functions from abstraction layer
Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
2018-11-30 23:42:19 +01:00
eboasson
69f563be5b
Merge pull request #60 from FirasSahliADLinktech/multiple_tests
Some missing unit tests and correct signature
2018-11-30 12:07:44 +01:00
Firas Sahli
6908e3deea
Correct signature and add tests for dds_instance_get_key
Signed-off-by: Firas Sahli <firas.sahli@adlinktech.com>
2018-11-28 10:52:14 +01:00
Firas Sahli
8aa6ceff81
Add test for dds_qos_copy and extra check to dds_qset_partition
Signed-off-by: Firas Sahli <firas.sahli@adlinktech.com>
2018-11-28 10:41:24 +01:00
Firas Sahli
4b627fd9aa
Add simple test for dds_time
Signed-off-by: Firas Sahli <firas.sahli@adlinktech.com>
2018-11-28 10:38:07 +01:00
Erik Boasson
ec68eeac29 Bring listener operations naming scheme in line with the rest
The main naming scheme is OPER_TYPE (i.e., dds_create_participant) but the listener operations were named TYPE_OPER (i.e., dds_listener_create). This commit brings the listener scheme in line with the rest, retaining the old names as a deprecated interface.

Signed-off-by: Erik Boasson <eb@ilities.com>
2018-11-09 14:18:51 +01:00
Erik Boasson
651bdfee06 Bring QoS operations naming scheme in line with the rest
The main naming scheme is OPER_TYPE (i.e., dds_create_participant) but the QoS operations were named TYPE_OPER (i.e., dds_qos_create). This commit brings the QoS scheme in line with the rest, retaining the old names as a deprecated interface.

Signed-off-by: Erik Boasson <eb@ilities.com>
2018-11-09 14:18:47 +01:00
Erik Boasson
4a4f4e22d1 dds_stream_extract_key: reserve space in destination before calling dds_stream_read_fixed_buffer
Signed-off-by: Erik Boasson <eb@ilities.com>
2018-10-29 21:37:06 +08:00
Erik Boasson
f2f436bde3 wrap indirect calls to WHC in inline functions
Signed-off-by: Erik Boasson <eb@ilities.com>
2018-10-29 13:28:19 +08:00
Erik Boasson
3e343d032a reduce dependency on sertopic->status_cb_entity
Signed-off-by: Erik Boasson <eb@ilities.com>
2018-10-29 13:26:24 +08:00
Erik Boasson
7cb80e7851 minor refactor of CDR-to-key/keyhash generation
Signed-off-by: Erik Boasson <eb@ilities.com>
2018-10-29 13:24:07 +08:00
Erik Boasson
259e4676dc fix sequencing of internal liveliness monitoring and rtps init/term
liveliness monitoring requires rtps stack initialised if initially deaf, so starting the monitoring thread must happen after rtps_init

Signed-off-by: Erik Boasson <eb@ilities.com>
2018-10-28 13:54:17 +08:00
Erik Boasson
9cab5e769c various interconnected changes for ddsi_serdata
- topic-erased key-only serdata for use in tkmap
- restoration of including key values in invalid samples
- special handling of keyless topics
- keyhash generation via streams
- elimination of dynamically allocated buffers in keyhash
- removal of the last vestiges of "serstate"

Signed-off-by: Erik Boasson <eb@ilities.com>
2018-10-28 13:31:23 +08:00
Erik Boasson
8e20ae547e avoid declaring an array on stack with non-constant size
Signed-off-by: Erik Boasson <eb@ilities.com>
2018-10-26 20:34:35 +08:00
Erik Boasson
e841e4bf94 add back in the broken filter and query condition support
the implementation was and is terrible, but without it too many tests fail

Signed-off-by: Erik Boasson <eb@ilities.com>
2018-10-26 20:05:18 +08:00
Erik Boasson
a25f683bcf abstract the internal representation of a sample
besides the old state being in dire need of cleaning up, this also paves the way for having any number of different sample representations in the system

Signed-off-by: Erik Boasson <eb@ilities.com>
2018-10-26 16:25:26 +08:00
Erik Boasson
bb92294f4e Let dds_create_participant determine domain id if config specifies "any" (new default)
Note: DDS_DOMAIN_DEFAULT with a configuration specifying "any" results in domain 0.
Signed-off-by: Erik Boasson <eb@ilities.com>
2018-10-14 14:02:47 +08:00
Erik Boasson
e040d61246 transmit path should use unicast socket
Signed-off-by: Erik Boasson <eb@ilities.com>
2018-09-21 11:00:43 +02:00
Erik Boasson
e84e644702 remove unused global mutex
Signed-off-by: Erik Boasson <eb@ilities.com>
2018-09-21 11:00:43 +02:00